Skip to content

CSS Variables extension, PX to EM #1389

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

honzis1364
Copy link

@honzis1364 honzis1364 commented Apr 9, 2025

Proposed change

Extend Bubble Card CSS Variables to give users easier access to theming.
Convert Bubble Card full to EM units instead of PX.

  • Added and extended CSS variables
  • Converted PX values to EM

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

.bubble-buttons-container {
    --icon-primary-color: var(--primary-text-color);
    display: flex;
    margin-right: var(--bubble-buttons-container-margin-right, 0.5em);
    margin-left: var(--bubble-buttons-container-margin-left, 0em);
    margin-top: var(--bubble-buttons-container-margin-top, 0em);
    margin-bottom: var(--bubble-buttons-container-margin-bottom, 0em);
    gap: var(--bubble-buttons-container-gap, 0.25em);
}

Example printscreens/gif

Visually Bubble Card remains the same:
image

Additional information

Some user styling could be overrided by these changes - to specify transition and margin. It has been splitted into standalone properties rather than using transition: all 1.5s; for future user-overrides specific (for ex. only to change the duration of the animation via variable).
Fallbacks remained the same. For users with compatibility issue - take a look at new css vars and consider changing them instead of other code overrides.
This PR opens the way to style Bubble Card more easily with just CSS variables without need to use !important.

Additional documentation needed.

.bubble-container {
     font-size: 16px; /* default font size for EM scaling */
 }

This can be used to scale Bubble Card proportionally and globally. Change the font-size to see how the Bubble Card scales. Changing this value scales everything, not just a font-size. To understand how does em / rem sizing works, take a look here: https://www.a11y-collective.com/blog/what-is-rem-in-css/

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests screenshots/gifs have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

  • Documentation added/updated for readme.

@honzis1364 honzis1364 changed the title CSS Variables extension, PX to REM CSS Variables extension, PX to EM Apr 9, 2025
@AlexDaniel
Copy link
Contributor

Out of curiosity, why em and not rem?

Also, I think dist/ changes should not be part of the PR.

Comment on lines 45 to 47
.large .bubble-container {
height: 44px;
--bubble-separator-height: 2.75em;
}

Choose a reason for hiding this comment

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

How does this work? I see you do this in more places.
I know that this works:
height: var(--bubble-separator-height, 2.75em);

But replacing:
height: 44px;
with:
--bubble-separator-height: 2,75em

How does CSS knows, that this is the height-property which is set here? Curious to learn/understand.

Comment on lines +13 to +14
transition-duration: var(--bubble-backdrop-transition-duration, 0.3s);
transition-timing-function: var(--bubble-backdrop-transition-timing-function, ease-in-out);

Choose a reason for hiding this comment

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

Indentation is off

@Clooos
Copy link
Owner

Clooos commented May 5, 2025

Hi! I hope you're doing well. I'm currently reviewing your PR and I've run into a few issues, actually the first three CSS files I checked (maybe just bad luck) needed some fixes because some elements were not looking the same 😅 I'll wait for your response before continuing, since I can't merge the PR as it is.

I'm planning to release the stable v3.0.0 in less than 2 weeks 🥳 So if I don't have news from you until that, this PR will be for the next release, like v3.0.1 🙂

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.

4 participants