-
Notifications
You must be signed in to change notification settings - Fork 153
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
perf: <StaticVoteButton />
#517
perf: <StaticVoteButton />
#517
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cleanly done so far! That is a good starting point.
|
||
export interface ItemSummaryProps { | ||
item: Item; | ||
isVoted: boolean; | ||
isSignedIn: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I wonder if having isVoted?: boolean
might be simpler, where it's undefined
if the user is not signed in. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I like that suggestion if reusing the isVoted
prop. What do you think about isVoted: boolean | undefined
instead since we probably want that prop to be required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isVoted?: boolean
is the same as isVoted: boolean | undefined
(reference). Having isVoted?: boolean
would mean it is optional. Btw, if, for whatever reason, it's not simpler, let's stick to using isSignedIn: boolean
.
<StaticVoteButton />
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, let's stick with this as #534 will also be using the isSignedIn
property. Thanks for this!
I created a component called
StaticVoteButton
. Struggled on the same but I'm open to suggestions to make it more clear if needed. Thetitle
attribute seemed to work well on hover (see attached screenshot).Related to #513