Skip to content

Conversation

@dancormier
Copy link
Contributor

@dancormier dancormier commented Nov 21, 2025

SPARK-103


Figma
Docs (Stacks Classic)
Storybook (Stacks Svelte)


This PR adds a vote component to Stacks Classic and Stacks Svelte.

Note

At the time of writing, downvote icons are not yet design so are instead shown using the placeholder icons. Once the downvote icons are updated in the stacks-icons packages, the correct icons should show.

Screenshots

Base

Light

image

Dark

image

Light HC

image

Dark HC

image

Expanded

image

Horizontal

image

Voted

image

@changeset-bot
Copy link

changeset-bot bot commented Nov 21, 2025

🦋 Changeset detected

Latest commit: fa90b94

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Nov 21, 2025

Deploy Preview for stacks-svelte ready!

Name Link
🔨 Latest commit fa90b94
🔍 Latest deploy log https://app.netlify.com/projects/stacks-svelte/deploys/693c99806d13d40008b1ae38
😎 Deploy Preview https://deploy-preview-2062--stacks-svelte.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Nov 21, 2025

Deploy Preview for stacks ready!

Name Link
🔨 Latest commit fa90b94
🔍 Latest deploy log https://app.netlify.com/projects/stacks/deploys/693c99800c112c0008747cfb
😎 Deploy Preview https://deploy-preview-2062--stacks.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

dancormier and others added 23 commits December 2, 2025 17:22
…#2004)

Bumps [stylelint-config-standard](https://github.com/stylelint/stylelint-config-standard) from 38.0.0 to 39.0.1.
- [Release notes](https://github.com/stylelint/stylelint-config-standard/releases)
- [Changelog](https://github.com/stylelint/stylelint-config-standard/blob/main/CHANGELOG.md)
- [Commits](stylelint/stylelint-config-standard@38.0.0...39.0.1)

---
updated-dependencies:
- dependency-name: stylelint-config-standard
  dependency-version: 39.0.1
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@dancormier dancormier requested a review from giamir December 9, 2025 23:04
@dancormier dancormier marked this pull request as ready for review December 9, 2025 23:04
Copy link
Collaborator

@mukunku mukunku left a comment

Choose a reason for hiding this comment

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

Changes are looking great. Noticed one thing: the selected state for horizontal layout doesn't match the one for comments in designs. Similarly, you can't click on the whole thing to upvote which I'm guessing isn't the intention 🤔

{279EFF0C-0FD5-4DC7-8971-7C1DA5E9CDFF} {26D5D4B6-493D-4237-9F94-0AD33ACBB63A}

Do we need an upvote-only mode or something maybe?

@CGuindon
Copy link
Collaborator

Downvote icons are available now (the vote icon but direction set to down)

@CGuindon
Copy link
Collaborator

CGuindon commented Dec 12, 2025

Confirming we don't have a use case currently where we have a horizontal version with both up and downvotes. We only have the horizontal single vote so wondering if we should just not show the version with 2 votes on horizontal (people shouldn't use this).

I'm ok keeping the version you have though where both up/down are possible and the focus/hover stays on one side. I think it still works fine even with just the upvote and it would save us time later if product decides to add in downvotes to comments/replies.

Copy link
Collaborator

@CGuindon CGuindon left a comment

Choose a reason for hiding this comment

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

New downvote icon needed (overall looks good though!)

@dancormier
Copy link
Contributor Author

dancormier commented Dec 12, 2025

the selected state for horizontal layout doesn't match the one for comments in designs

Nice catch @mukunku! I built it with this in mind originally but completely spaced when making the examples and Svelte component. Fixed!


I'm ok keeping the version you have though where both up/down are possible and the focus/hover stays on one side. I think it still works fine even with just the upvote and it would save us time later if product decides to add in downvotes to comments/replies.

@CGuindon Sal pointed out that I missed the configuration in the Figma. I've updated the horizontal orientation to match what's in Figma where the element is just one upvote button that includes the vote count. If/when we want to allow for downvotes on the horizontal orientation, we'll be able to do that pretty trivially.

Downvote icons are available now (the vote icon but direction set to down)

The standard (20x20) downvote icon is available but we need the 16px ones for this component. We can still merge without them and once they're published and the icons library dependency is updated, this component will display them with no further changes besides regenerating the test images.

@mukunku mukunku self-requested a review December 15, 2025 14:52
Copy link
Collaborator

@mukunku mukunku left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@giamir giamir left a comment

Choose a reason for hiding this comment

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

Great work @dancormier. I really like this component.

The only thing I noticed is that we automatically update the total number but not the upvotes and downvotes numbers.

Screenshot 2025-12-17 at 10 46 47

I am actually unsure if updating the different counts is something we should do in the design system component directly or rather have the consumers take care of it. We don't have control over what the server returns and how the API looks like and we risk to show an incorrect value to the user (imagine a call is done to the server to register an upvote and the server come back with a different score because in the meantime somebody else has also casted a vote, etc...).

That said I am happy to merge it as is and maybe have those conversations with the first team implementing the component.

A small nit. the prop we call total in the component is called score in our APIs (check for example the schema of the response for questions/id). It would be nice probably to stick to score also here but total is ok too. 🙂

@CGuindon
Copy link
Collaborator

The Svelte component was built to update the count and wait for a promise to resolve to confirm the vote count was updated on the server-side. It makes sense to do the same thing for the separate counts.

Slack thread

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.

5 participants