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

Improve CSS vars #528

Merged
merged 16 commits into from
Apr 17, 2023
Merged

Improve CSS vars #528

merged 16 commits into from
Apr 17, 2023

Conversation

luwes
Copy link
Contributor

@luwes luwes commented Apr 11, 2023

Closes #473
Fixes #453

  • Fixes some outdated documenting
  • Makes all colors the same uniform rgb() syntax
  • Adds --media-primary-color
  • Adds --media-secondary-color
  • Adds --media-tertiary-color
  • Adds --media-text-color
  • Adds --media-font, --media-font-weight, --media-font-size, --media-font-family

@luwes luwes self-assigned this Apr 11, 2023
@vercel
Copy link

vercel bot commented Apr 11, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
media-chrome ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 12, 2023 6:43pm
media-chrome-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 12, 2023 6:43pm

@codecov
Copy link

codecov bot commented Apr 11, 2023

Codecov Report

Merging #528 (3918a77) into main (f31d5a3) will decrease coverage by 0.04%.
The diff coverage is 100.00%.

❗ Current head 3918a77 differs from pull request most recent head aa8643a. Consider uploading reports for the commit aa8643a to get more accurate results

@@            Coverage Diff             @@
##             main     #528      +/-   ##
==========================================
- Coverage   75.53%   75.49%   -0.04%     
==========================================
  Files          41       41              
  Lines        7017     7008       -9     
==========================================
- Hits         5300     5291       -9     
  Misses       1717     1717              
Impacted Files Coverage Δ
src/js/media-chrome-button.js 84.57% <100.00%> (-0.31%) ⬇️
src/js/media-chrome-range.js 89.85% <100.00%> (ø)
src/js/media-control-bar.js 76.47% <100.00%> (ø)
src/js/media-loading-indicator.js 83.11% <100.00%> (ø)
src/js/media-text-display.js 97.11% <100.00%> (ø)
src/js/media-time-range.js 59.38% <100.00%> (-0.44%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@luwes luwes marked this pull request as ready for review April 11, 2023 15:40
@luwes luwes requested review from a team and heff as code owners April 11, 2023 15:40
Copy link
Contributor

@gkatsev gkatsev left a comment

Choose a reason for hiding this comment

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

Overall, 👍🏻

| `--media-button-icon-transition` | `transform` | none | apply a [transition](https://developer.mozilla.org/en-US/docs/Web/CSS/transition) to button icons | Only applies to `<img>` and `<svg>` tags |
| Name | CSS Property | Default Value | Description | Notes |
| ---------------------------------- | ------------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--media-control-background` | `background` | `var(--media-secondary-color, rgb(20 20 30 / .7))` | background color of the component | Applies to other components as well ([See notes below \*\*](#notes)) |
Copy link
Contributor

Choose a reason for hiding this comment

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

should --media-primary-color and --media-secondary-color get their own section at the top?

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like the new font css vars aren't documented either. Thinking about this, might be fine to skip for now since we have an upcoming effort to update documentation for this.

<style>
:host {
font: var(--media-font,
Copy link
Contributor

Choose a reason for hiding this comment

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

At first, I was worried that moving into the shorthand property it'll cause issues if someone were to set a specific property or the font property on the element, but after trying it out, that seems unfounded and working as expected.

<style>
:host {
font: var(--media-font,
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 I would still slightly prefer individual properties over the font shorthand. It's more explicit and would help with searchability, since you could find it via grepping for say line-height.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cool will update. I don't feel so strongly about it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh actually then we can't use --media-font as a CSS var for setting all at once which includes some more things like

font-stretch
font-style
font-variant

I think that extra function and it taking less CSS makes it a better choice. what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

Theoretically, we could do some fancy var stuff to unset the other properties if --media-font is set, but probably too much work. Is --media-font needed?
While, I do think the individual properties are a bit better, I'm OK with keeping it as the shorthand.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is --media-font needed?

it would give devs the full flexibility of all font css props if needed with small addition in code size.
seems like a good devex

<style>
:host ul {
font: var(--media-font,
Copy link
Collaborator

Choose a reason for hiding this comment

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

praise: As long as we don't run into any hurdles/friction, I think I'm digging this solution for shorthand vs. specific css props. 😎

Copy link
Collaborator

@cjpillsbury cjpillsbury left a comment

Choose a reason for hiding this comment

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

This is awesome. One non-blocking callout - looks like the new font css vars aren't applied to all places where we have text: Immediately comes to mind: media-playback-rate-button, media-live-button (though there may be others I'm missing?)

@luwes
Copy link
Contributor Author

luwes commented Apr 17, 2023

the buttons are def covered via media-chrome-button. should be good

@luwes luwes merged commit 33cd238 into muxinc:main Apr 17, 2023
@luwes luwes deleted the css-vars branch April 17, 2023 16:13
@cjpillsbury
Copy link
Collaborator

the buttons are def covered via media-chrome-button. should be good

@luwes whoops just missed that in the quick review. 🚀

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.

Add CSS var to set the font family on media-time-display
3 participants