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

Draft PR for discussion: transition to CSS varaibles only. #1044

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

Conversation

stephaniehobson
Copy link
Contributor

Draft PR for discussion.

@@ -10,73 +10,41 @@
.mzp-u-title-2xl {
@include text-title-2xl;
font-family: $title-font-family;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe font-family should be part of the @include text-title-n declaration?

--title-xs-line-height: 1.166;
--title-2xs-size: 1.25rem;
--title-2xs-line-height: 1.2;
--title-2xl-size: 3.5rem;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've been toying with the idea of variable names that make it clear that they morph with media queries. Alternative name ideas:

  • --scale-title-2xl-size: 3.5rem;(colours could use theme, nice because it gives a clue of the variable value)
  • --let-title-2xl-size: 3.5rem; (javascript reference: const vs let, mostly nice because its short, we should not have any const CSS vars, they should be Sass vars)
  • --find-title-2xl-size: 3.5rem; (nice because all dynamic variables can use the same prefix)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But if we follow the rule that CSS variables should ONLY be used for dynamic variables then maybe the prefix is unnecessary? But then, is there value in making it explicit for contributors and users of the system who don't know the rules?

line-height: var(--title-2xl-line-height);
}
}
font-size: var(--title-2xl-size);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would putting the CSS variable into a Sass variable help with readability and authoring speed? Or would it add to confusion?

It would be SO NICE to just type --title-2xl-size.

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.

1 participant