Skip to content

Commit

Permalink
fix: remove bookmark button state
Browse files Browse the repository at this point in the history
  • Loading branch information
martyanovandrey committed Jan 17, 2022
1 parent 54d65d2 commit f5555d9
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/components/BookmarkButton/BookmarkButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useState} from 'react';
import React from 'react';
import block from 'bem-cn-lite';

import {Button} from '../Button';
Expand All @@ -20,19 +20,16 @@ export const BookmarkButton: React.FC<BookmarkButtonProps> = ({
bookmarkedPage,
onChangeBookmarkPage,
}) => {
const [pinnedPage, setPinnedPage] = useState(bookmarkedPage);

return (
<Button
className={b({active: pinnedPage})}
className={b({active: bookmarkedPage})}
onClick={() => {
setPinnedPage(!pinnedPage);
onChangeBookmarkPage(!pinnedPage);
onChangeBookmarkPage(!bookmarkedPage);
}}
theme={'clear'}
size="s"
>
{pinnedPage ? <StarActive /> : <StarInactive />}
{bookmarkedPage ? <StarActive /> : <StarInactive />}
</Button>
);
};

0 comments on commit f5555d9

Please sign in to comment.