Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a small bounce when bookmarking a puzzle #1940

Merged
merged 1 commit into from
Jan 6, 2024
Merged

Conversation

ebroder
Copy link
Member

@ebroder ebroder commented Jan 6, 2024

Screen.Recording.2024-01-05.at.2.14.13.PM.mov

Comment on lines +8 to +22
interface BookmarkButtonProps<As extends React.ElementType = React.ElementType>
extends React.HTMLAttributes<HTMLElement> {
puzzleId: string;
bookmarked: boolean;
as?: As;
}

type BookmarkButtonType = <
As extends React.ElementType = typeof Button
>(
props: BookmarkButtonProps<As> & Omit<React.ComponentPropsWithRef<As>, keyof BookmarkButtonProps>,
context?: any,
) => React.ReactNode;

const BookmarkButton: BookmarkButtonType = React.forwardRef<HTMLElement, BookmarkButtonProps>(({
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the record, these type shenanigans are pretty heavily inspired by some similar type shenanigans in react-bootstrap.

@ebroder ebroder enabled auto-merge January 6, 2024 00:22
icon={bookmarked ? faStarSolid : faStarRegular}
beat={animateBookmark}
onAnimationEnd={onAnimationEnd}
style={{ '--fa-animation-iteration-count': 1, '--fa-animation-duration': '0.5s' }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels just a little slow -- can we make the duration here, say, 0.2s instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me, updated

@ebroder ebroder merged commit 218c0be into main Jan 6, 2024
1 check passed
@ebroder ebroder deleted the evan/animations branch January 6, 2024 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants