⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@ttaylor-stack
Copy link
Collaborator

@ttaylor-stack ttaylor-stack commented Jan 14, 2026

SPARK-127

Figma

This PR covers part 2 of the User Card component which includes:

  • States:
    • New contributor
    • Original poster
    • Deleted
  • Additional bling
    • Recognized member (collectives)
    • top 3 leaderboard (collectives)

@ttaylor-stack ttaylor-stack requested review from CGuindon, dancormier and giamir and removed request for dancormier January 16, 2026 09:59
@ttaylor-stack ttaylor-stack marked this pull request as ready for review January 16, 2026 11:58
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.

Thanks Tavian for the PR. As you can see I am asking for few changes. Hopefully they are all understandable if not let me know and we can pair.

For the svelte component I suggest to create a UserCardAdditionalBling subcomponent so that we don't have to add a lot of logic and props in the existing root UserCard component but just a snippet.

Sidenote
I think AdditionalBling is a pretty poor name to describe the little extra icons that can be added to between the badges and the blings but it is what we have in Figma so I guess we can roll with it. I don't have a better name for now. cc @CGuindon

&:before {
height: var(--_ba-before-h);
margin-top: 0;
margin-left: calc(var(--su2) * -1); // -2px margin
Copy link
Contributor

Choose a reason for hiding this comment

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

We should have --sun2 now after Dan's PR got merged

color: var(--black-400);
}

& &--original-poster {
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this should be named s-user-card--username__op? cc @dancormier

word-break: break-all;
}

& &--awarded-third {
Copy link
Contributor

Choose a reason for hiding this comment

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

How are those used? I cannot find them in the docs snippets?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's used to set the colors for the additional bling trophies. It's used in the awarded snippet like so

<div class="s-user-card--group s-user-card--awarded-third" title="…" data-controller="s-tooltip"> @Svg.Icon.AchievementsSm.With("native") </div>

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for clarifying. I would like to get @dancormier opinions on the API naming here. There is a part of me that still wonder if this "additional blings" are worthy to be included already in the central library or we should just have the consumer define them for now and only centralize when we see the pattern is used across several scenarios (not just collectives). What I mean is that instead of creating a s-user-card--awarded-third class to add just the color consumers could use atomic color classes and take care of it themselves (we could still keep an example in the docs but we won't have any dedicated less). The equivalent in the svelte component world would be just to have a snippet (e.g. additionalBlings - it would be nice to find a better name but it is what it is) to plug things in it but also there we will allow consumers to pass in it whatever they want.

Also cc @CGuindon for visibility.

Copy link
Contributor

Choose a reason for hiding this comment

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

By the way what I am suggesting is some version of the last responsible moment. Do we have enough confidence to nail the API at this stage, with the information and the use case we have or is it better to keep things flexible for the time being and defer centralization of some styling to a later moment.

color: var(--black-400);
}

& &--original-poster {
Copy link
Contributor

Choose a reason for hiding this comment

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

The design differ compared to figma

PR
Screenshot 2026-01-16 at 15 47 38

Figma
Screenshot 2026-01-16 at 15 49 11

import Popover from "../Popover/Popover.svelte";
import PopoverReference from "../Popover/PopoverReference.svelte";
import PopoverContent from "../Popover/PopoverContent.svelte";
import avatarDeleted16 from "../../assets/img/avatar-deleted-16.svg?url";
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this inline the asset otherwise it won't work after things get bundled?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we could probably create an AvatarDeleted16.svelte and an AvatarDeleted24.svelte components in the UserCard folder for now with the svg in it.

{@render badges()}
</ul>
{/if}
{#if award}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we would be better off to create UserCardAdditionalBling subcomponent here for consumer to use. We are inferring too much from the value of award (tooltip text, class, etc...). And then just have a additionalBling snippet in the root UserCard component.


{#snippet userCardMainContent()}
{@render avatarAndName()}
{#if recognition && size === "sm"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need recognitionHref?
Can we actually make the UserCardAdditionalBling subcomponent generic so that the consumer can decide if they want to show the "little cup icon" bling or the "recognition icon" bling instead? It would be nice to keep the additions on the UserCard.svelte component to a minimum. As I said in a previous comment maybe just a additionalBling (or additionalBlings) snippet depending if more than one bling can be displayed together or not. Keep things generic and then have any additional logic in the UserCardAdditionalBling subcomponent.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In the Figma it states that the additional bling icons need to provide links to either the collective leaderboard or the collective landing page, this is a way for the user to provide this. I've removed it from UserCard.Svelte and placed it into the additional bling subcomponent

image

},
{
"name": "New Contributor",
"class": "s-user-card--new-contributor",
Copy link
Contributor

Choose a reason for hiding this comment

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

This class does not exist in less, we should probably remove it from the docs and the examples

Copy link
Contributor

Choose a reason for hiding this comment

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

@ttaylor-stack it looks like there are still references of the s-user-card--new-contributor class across the codebase, Maybe you want to do an old fashion CTRL+F and make sure everything is cleaned up. Thank you. 🙂

<svelte:element
this={recognitionHref ? "a" : "div"}
href={recognitionHref}
class="s-user-card--group s-user-card--recognition"
Copy link
Contributor

Choose a reason for hiding this comment

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

The same s-user-card--recognition is used for 2 purposes:

  • for the container element "Recognized by..."
  • for the recognition icon in the additional blings section

I think this is confusing, we are probably better off create another class for the additional blings part

</ul>
{/if}
{#if award}
<Popover id="user-card-award-popover" tooltip>
Copy link
Contributor

Choose a reason for hiding this comment

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

popover ids need to be unique for the whole page so if we generate them inside svelte we need to either create a random text we can append to them or ask the consumer to do that

--_uc-username-d: flex;
--_uc-username-ai: center;
.s-user-card__sm & {
--_uc-username-p: 0px var(--su4);
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: incorrect indentation and px (unit of measure) not necessary

"test:watch": "npm run build:dependencies && web-test-runner --watch",
"test:tools": "npm run storybook:build && node --test tools/*.test.js",
"storybook": "storybook dev -p 6006",
"storybook": "npm run build:dependencies && storybook dev -p 6006",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this bit @ttaylor-stack? We shouldn't need it since the less files of stacks classic are compiled on the fly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was getting this error [ERROR] Failed to resolve entry for package "@stackoverflow/stacks-utils". The package may have incorrect main/module/exports specified in its package.json. [plugin vite:dep-scan]

I've removed it and it seems to be working atm

Copy link
Contributor

Choose a reason for hiding this comment

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

I was actually suggesting something dumber than this. HTML (like SVGs) are valid svelte component. So AvatarDeleted16.svelte would basically be as simple as:

<svg ...>
  ...source code now under `assets/img` folder
</svg>

If you prefer we could name the component AvatarDeleted16Svg.svelte or AvatarDeleted16Raw.svelte but it does not really matter since they are internal only to the UserCard. Nothing else can or should use it for now.
That way we don't need to create an assets folder at all for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should sync about this. Perhaps I don't fully see all limitations/issues we would have with the approach I am suggesting.

/**
* Unique id for the popover
*/
popoverId: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

no need to call this popoverId, we just need an id for the component and should only knows that. That we use that for a popover internally is an implementation detail. 🙂

icon: string;
/**
* href for the link to leaderboard or collective landing page
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the description should be more generic
link for the additional bling element (e.g. leaderboard or collective landing page)

/**
* Snippet used to display user bio
* Snippet used to display user recognized member
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need a dedicated snippet for the recognized member bling? Can everything fall under the additionalBlings snippet umbrella?

It looks like all additionalBlings are always rendered after the badges according to figma
Screenshot 2026-01-19 at 15 26 25

At the moment it seems we are placing the recognized member one before the badges snippet which should not be the case. I think one more reason to have a single snippet called additionalBlings.

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.

4 participants