-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Implement bookmark button component - Integrate bookmark functionality in Posts and PostCard components - Add bookmark list page to view all bookmarked posts - Include state management for bookmarks using useState - Update routes in App component to include /app/bookmarks - Ensure posts can be filtered by tags with the new filter dialog - Improve UX with conditional rendering of loader and error messages
- Loading branch information
1 parent
a3de091
commit e0b9a1c
Showing
5 changed files
with
67 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React, { useState } from 'react'; | ||
|
||
interface BookmarkButtonProps { | ||
item: string; | ||
onBookmark: (item: string) => void; | ||
isBookmarked: boolean; | ||
} | ||
|
||
const BookmarkButton: React.FC<BookmarkButtonProps> = ({ item, onBookmark, isBookmarked }) => { | ||
return ( | ||
<button onClick={() => onBookmark(item)}> | ||
{isBookmarked ? 'Remove Bookmark' : 'Add Bookmark'} | ||
</button> | ||
); | ||
}; | ||
|
||
export default BookmarkButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from 'react'; | ||
|
||
interface BookmarkListProps { | ||
bookmarks: string[]; | ||
onRemove: (item: string) => void; | ||
} | ||
|
||
const BookmarkList: React.FC<BookmarkListProps> = ({ bookmarks, onRemove }) => { | ||
return ( | ||
<div> | ||
<h2>Bookmarked Items</h2> | ||
<ul> | ||
{bookmarks.map((bookmark, index) => ( | ||
<li key={index}> | ||
{bookmark} <button onClick={() => onRemove(bookmark)}>Remove</button> | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
); | ||
}; | ||
|
||
export default BookmarkList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters