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

[WIP] Polaris tokens base/variant themes #9877

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

aaronccasanova
Copy link
Member

@aaronccasanova aaronccasanova commented Aug 2, 2023

This PR explores a base/variant theme architecture for Polaris tokens where the base theme is the foundation for any number of variant themes. Variant themes have two primary constraints in that they can only extend the base theme and they are the only theme exposed to consumers.

One advantage of this pattern is that system changes can be made more predictably by flattening the relationship between themes (without needing to consider deeply inherited themes). For example:

❌ With deeply inherited themes

flowchart TD
    A[Base Theme]
    A --> B[Light Theme]
    B --> C[Light High Contrast Theme]
    A --> D[Dark Theme]
    D --> E[Dark High Contrast Theme]
    A --> F[Dim Theme]
    A --> G[etc...]
Loading

✅ With base/variant themes

flowchart TD
    A[Base Theme]
    A --> B[Light Theme]
    A --> C[Light High Contrast Theme]
    A --> D[Dark Theme]
    A --> E[Dark High Contrast Theme]
    A --> F[Dim Theme]
    A --> G[etc...]
Loading

Note: @shopify/polaris-tokens continues to generate a single source of truth stylesheet but separates base and variant theme custom properties into dedicated selectors to reduce duplication:
Screenshot 2023-08-02 at 3 53 56 PM

Copy link
Contributor

Hi! We noticed there hasn’t been activity on this PR in a while. After 30 days, it will close automatically.

If it’s still relevant, or you have updates, comment and let us know. And don’t worry, you can always re-open later if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-needed Added by a bot. Contributor needs to sign the CLA Agreement. no-pr-activity Tokens
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants