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

Extract CSS vars from RAC docs into reusable package #5419

Merged
merged 3 commits into from Nov 16, 2023
Merged

Conversation

devongovett
Copy link
Member

@devongovett devongovett commented Nov 15, 2023

This updates the examples in the RAC docs to use a shared set of CSS variables rather than each component defining their own. This will also be published as an example theme on npm so that copy/pasting the example code works without any Spectrum variables, and it's easy to start by modifying the theme/styles.

The base colors were generated with Leonardo to ensure contrast ratios in light and dark mode, with semantic variables defined on top of those. This also allows us to centralize all of the Windows high contrast mode logic into the theme, which reduces a lot of code in the individual docs examples.

The example theme package uses media queries for dark mode, but in our docs we also have a manual theme switcher. We make this work using a small lightningcss plugin to convert the media query to a selector that looks for the color-scheme: dark style on the root element in our docs.

Lastly, I included a CSS change to migrate from using box-shadow for focus rings to using outline now that all browsers actually respect the border radius. This also simplifies WHCM because outline renders by default whereas box-shadow does not.

@rspbot
Copy link

rspbot commented Nov 15, 2023

@rspbot
Copy link

rspbot commented Nov 15, 2023

## API Changes

unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any', access: 'private' }
unknown top level export { type: 'any', access: 'private' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'identifier', name: 'Column' }
unknown top level export { type: 'identifier', name: 'Column' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }

Copy link
Member

@snowystinger snowystinger left a comment

Choose a reason for hiding this comment

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

did a quick sweep in both dark and hcm, looks good so far
lets get this in for testing

@devongovett devongovett merged commit 5dac45c into main Nov 16, 2023
26 checks passed
@devongovett devongovett deleted the example-theme branch November 16, 2023 19:12
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.

None yet

4 participants