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

perf: <StaticVoteButton /> #517

Merged
merged 4 commits into from
Sep 8, 2023

Conversation

ryanponce
Copy link
Contributor

I created a component called StaticVoteButton. Struggled on the same but I'm open to suggestions to make it more clear if needed. The title attribute seemed to work well on hover (see attached screenshot).

Screenshot 2023-09-05 at 9 38 36 PM

Related to #513

Copy link
Contributor

@iuioiua iuioiua left a 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.

routes/index.tsx Outdated Show resolved Hide resolved

export interface ItemSummaryProps {
item: Item;
isVoted: boolean;
isSignedIn: boolean;
Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor

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.

routes/users/[login].tsx Outdated Show resolved Hide resolved
@iuioiua iuioiua changed the title perf: Create Static Version of Vote Button perf: <StaticVoteButton /> Sep 6, 2023
Copy link
Contributor

@iuioiua iuioiua left a 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!

@iuioiua iuioiua merged commit 0d1dc98 into denoland:main Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants