Skip to content

Use new tokens throughout Glide Core #750

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

Merged
merged 53 commits into from
Mar 31, 2025
Merged

Use new tokens throughout Glide Core #750

merged 53 commits into from
Mar 31, 2025

Conversation

ynotdraw
Copy link
Collaborator

@ynotdraw ynotdraw commented Mar 7, 2025

🚀 Description

This PR is pretty massive. I broke the changes into chunks. Feel free to review by commit as well (I'll be sure to squash on merge!).

Token Updates

We removed almost all of our old tokens in favor of the new ones using the code from #732. This moves every component to our new tokens using the script I wrote (and some manual ❤️). There's a lot here, sorry! But this brings us about 90% aligned with the new designs. The remaining 10% will be worked on over the next few weeks in downstream PRs as they're lower priority.

CSS Variable Generation Updates

Moved to a constants.ts file for all configuration related items. This simplified the arguments to the different functions.

Line heights are now generated using rem values to match design.

I updated our Figma fetching code to allow for extended styles. Extended styles are variables local to a component. They are prefixed with --glide-core-private-. We need to expose them due to the way our stylesheets work with themes. The hope is that the name -private- prevents folks from using them directly.

Rather than making all 146 extended styles available, we use a subset of them via the extendedVariables array.

CEM Shuffling

Moved ../library/get-parent-class-name.js out from library and into the cem-analyzer-plugins directory instead. Figma code is all colocated. CEM plugin code can/should be too?

📋 Checklist

  • I have followed the Contributing Guidelines.
  • I have added tests to cover new or updated functionality.
  • I have added or updated Storybook stories.
  • I have localized new strings.
  • I have followed the ARIA Authoring Practices Guide or met with the Accessibility Team.
  • I have included a changeset.
  • I have scheduled a design review.
  • I have reviewed the Storybook and Visual Test Report links below.

🔬 Testing

Review Storybook and see if anything is totally busted. The visual tests failing are expected. Here is a high-level overview of some of the main changes:

  • Most line-heights were removed
    • This was something we did in v2 to account for Figma's text trimming
    • Talked with Zheng - we no longer need this for most cases
    • This means that some content will be pushed slightly down when viewing the VRT report
    • There are still a few components leveraging them. These will be cleaned up in another PR, along with some other updates.
  • Button secondary and tertiary states have been redesigned
  • Button colors in dark mode have been changed to different values
  • Icon Button was updated to follow Button's changes
  • Checkbox when indeterminate and disabled has a new visual design
  • Split Button was visually redesigned
  • Radio's selected, hover, and disabled visuals were updated.
  • Box shadow values have changed and been redesigned. They're now named differently as well.

I've gone through all 377 visual test failures a couple of times now and everything looks expected to me 👍.

📸 Images and videos

Too many to list 😆 ! Viewing the visual test report is a good place to go.

@ynotdraw ynotdraw self-assigned this Mar 7, 2025
Copy link

changeset-bot bot commented Mar 7, 2025

🦋 Changeset detected

Latest commit: e012f31

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

This PR includes changesets to release 1 package
Name Type
@crowdstrike/glide-core Minor

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

Copy link
Contributor

github-actions bot commented Mar 7, 2025

Copy link
Contributor

github-actions bot commented Mar 7, 2025

@ynotdraw ynotdraw force-pushed the use-new-tokens branch 2 times, most recently from 89fba95 to b2e4e37 Compare March 11, 2025 18:50
@ynotdraw ynotdraw changed the title [WIP] Use new tokens throughout Glide Core Use new tokens throughout Glide Core Mar 12, 2025
@ynotdraw ynotdraw force-pushed the use-new-tokens branch 4 times, most recently from f81e15b to bdfaeaf Compare March 12, 2025 13:31
border-start-end-radius: 0.6875rem;
}

:host(:last-of-type) .component.vertical {
border-block-end: none;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Needed to match the new designs. Otherwise the border looked doubled-up on the end with the other changes in this file.

Comment on lines +116 to +124
&:hover {
background-color: var(
--glide-core-color-interactive-surface-container--hover
);
border-color: var(
--glide-core-color-interactive-surface-container--hover
);
color: var(--glide-core-color-interactive-text-link);
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Button Group Button when selected now has hover styles according to the designs 🎉

@@ -9,7 +9,7 @@ import {
type Node,
} from 'typescript';
import postcss, { Comment, Declaration, Rule } from 'postcss';
import getParentClassName from '../library/get-parent-class-name.js';
import getParentClassName from './get-parent-class-name.js';
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Moved ../library/get-parent-class-name.js out from library and into the cem-analyzer-plugins directory instead. Figma code is all colocated. CEM plugin code can/should be too?

Comment on lines +118 to +125
.indeterminate-icon {
fill: var(--glide-core-private-color-checkbox-icon-default--disabled);
stroke: var(
--glide-core-private-color-checkbox-icon-default--disabled
);
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Checkbox when indeterminate and disabled has a new visual design

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Moved to a constants.ts file for all configuration related items. This simplified the arguments to the different functions.

// This information can be found in Figma's
// Deatils modal when clicking on an extended
// style by combining the collection information
// with the variable's full name.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As an example:

Screenshot 2025-03-12 at 8 58 03 AM

Can copy the collection (bottom) and the full variable name (top)

.gitignore Outdated
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These are no longer needed now that we've moved over to the new token code

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Due to whitespace trimming in src/cem-analyzer-plugins/add-slots.ts

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Cleaned out most of these! The only items left are custom "effect styles" as they're referred to in Figma. I have a task to look into how we might pull these from Figma's API, but until then, these are manually updated and named to align with Figma.

Comment on lines 15 to 27
- Button secondary and tertiary visual states have been redesigned.
- Button colors in dark mode have been changed to different values.
- Icon Button was updated to follow Button's changes.
- Checkbox when indeterminate and disabled has a new visual design.
- Split Button was visually redesigned.
- Radio's selected, hover, and disabled visuals were updated.
- Explicitly set `line-height`s were removed from most components.
Copy link
Collaborator Author

@ynotdraw ynotdraw Mar 12, 2025

Choose a reason for hiding this comment

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

Worth calling out a few more changes since these lead to visual regression test failures.

Suggested change
- Button secondary and tertiary visual states have been redesigned.
- Button colors in dark mode have been changed to different values.
- Icon Button was updated to follow Button's changes.
- Checkbox when indeterminate and disabled has a new visual design.
- Split Button was visually redesigned.
- Radio's selected, hover, and disabled visuals were updated.
- Explicitly set `line-height`s were removed from most components.
- Button secondary and tertiary visual states have been redesigned.
- Button colors in dark mode have been changed to different values.
- Icon Button was updated to follow Button's changes.
- Checkbox when indeterminate and disabled has a new visual design.
- Split Button was visually redesigned.
- Radio's selected, hover, and disabled visuals were updated.
- Explicitly set `line-height`s were removed from most components.
- Toast colors in dark mode have been changed to different values.
- Box shadow values have been redesigned.

@ynotdraw ynotdraw marked this pull request as ready for review March 12, 2025 13:55
Comment on lines +1 to +9
:root,
.theme-light {
--color-template-surface-background-page: #ffffff00;
}

:host,
.theme-dark {
--color-template-surface-background-page: #141414;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There are extended styles for this. But they're only used by Storybook. It wasn't worth exposing these to the world just for this one case, in my opinion. Let me know if you feel differently.

cursor: pointer;
display: flex;
font-family: var(--glide-core-font-sans);
font-size: var(--glide-core-body-md-font-size);
font-style: var(--glide-core-heading-xxs-font-style);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed all font-style as normal is the default and we have no need for any other options.

font-family: var(--glide-core-body-sm-font-family);
font-size: var(--glide-core-body-sm-font-size);
font-style: var(--glide-core-body-sm-font-style);
font-variant: var(--glide-core-body-sm-font-variant);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Similar to font-style, we use the default font-variant, so no need to be explicit.

@clintcs
Copy link
Collaborator

clintcs commented Mar 12, 2025

Too many to list 😆 ! Viewing the visual test report is a good place to go.

Maybe we should rename that section to just Videos given we now have the visual report.

@ynotdraw
Copy link
Collaborator Author

@clintcs I was wondering the same actually. The visual test report handles images.

I almost wonder if we remove "📸 Images and videos" completely? If you want to add a video, you can in the " 🚀 Description" section. I don't think folks add many videos these days.

@clintcs
Copy link
Collaborator

clintcs commented Mar 12, 2025

Went through all the changes. The visual report made doing so a breeze. Lots of nice dark mode improvements especially.

Would you say dark mode is still beta?

Our CSS custom properties have been updated to follow a new semantic token format:

```
--glide-core-{collection}-{category*}-{scope*}-{property}-{variant*}--{state*}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Worth concisely defining what each semantic part means or providing an example variable?

I ask because I can imagine people reading this and immediately having questions or assuming that the terms map to technical terms.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Great call. I'll cook something up here in a bit and get your thoughts!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Let me know what you think - this is directly from design: 714040b

Copy link
Collaborator

Choose a reason for hiding this comment

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

Works for me!

@@ -51,8 +51,8 @@ export default () => {
};
}

const block = commentParser(`/**
Copy link
Collaborator

Choose a reason for hiding this comment

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

Gotta love it.

@@ -105,12 +113,12 @@ export default [
/* The input obscures an offset outline for -webkit-calendar-picker-indicator, so 'focus-outline' is not used */
&[type='date'] {
&::-webkit-calendar-picker-indicator {
border-radius: var(--glide-core-border-radius-xs);
padding: var(--glide-core-spacing-xxs);
border-radius: 0.125rem;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah. So we will still have some hardcoded values.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, unfortunately in a few cases. It's on my list to go back through cases like this one and see if we can remove it in favor of another variable though!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Either way. Still overall much more amenable to a lint rule against hardcoded values. The few left can just disable the rule.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Totally agree!

@clintcs
Copy link
Collaborator

clintcs commented Mar 12, 2025

I was wondering the same actually. The visual test report handles images.

No need to push another commit unless you want to. I can open a separate PR for this.

@clintcs clintcs mentioned this pull request Mar 12, 2025
@ynotdraw
Copy link
Collaborator Author

Would you say dark mode is still beta?

@clintcs I contemplated removing this as well! I've got about another week or so left of work in the area of variables, so I imagine there will be a few more tweaks here and there. But once I get through those, I think we can safely remove the beta part 🎉

@ynotdraw
Copy link
Collaborator Author

No need to push another commit unless you want to. I can open a separate PR for this.

I can roll this in. Deletion incoming.

@clintcs
Copy link
Collaborator

clintcs commented Mar 12, 2025

I can roll this in. Deletion incoming

Too late!

@danwenzel
Copy link
Collaborator

So with tertiary buttons now having a background on hover, etc, we'll probably run into some issues in consuming apps where they'll need to now add some gap. We have an example of that happening now, with the Modal Tertiary button:

image

@danwenzel
Copy link
Collaborator

danwenzel commented Mar 12, 2025

Issue I'm seeing with transparency of Tooltip body, in Modal Tertiary button story, in dark mode:

image

@ynotdraw ynotdraw marked this pull request as ready for review March 28, 2025 16:48
@ynotdraw
Copy link
Collaborator Author

ynotdraw commented Mar 28, 2025

@danwenzel @clintcs should be all ready to go again. Had a few more rounds of review with design. It required a couple more iterations. We also reviewed the visual testing report multiple times and verified the changes are what we expect.

I've broken things up into separate commits for easier reviewing:

If you wouldn't mind giving this a 👍 or re-approval after you've taken a look, I'd greatly appreciate it. I'm hoping to land this on Monday.

@clintcs
Copy link
Collaborator

clintcs commented Mar 31, 2025

If you wouldn't mind giving this a 👍 or re-approval after you've taken a look, I'd greatly appreciate it. I'm hoping to land this on Monday.

Went through all the screenshots. Looks good to me!

@danwenzel
Copy link
Collaborator

If you wouldn't mind giving this a 👍 or re-approval after you've taken a look, I'd greatly appreciate it. I'm hoping to land this on Monday.

Went through all the screenshots. Looks good to me!

Same here, :shipit: !

@ynotdraw ynotdraw added this pull request to the merge queue Mar 31, 2025
Merged via the queue into main with commit 418008e Mar 31, 2025
29 checks passed
@ynotdraw ynotdraw deleted the use-new-tokens branch March 31, 2025 14:44
@github-actions github-actions bot mentioned this pull request Mar 31, 2025
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.

3 participants