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

Update card pattern to support color themes #5112

Merged
merged 1 commit into from
Jun 12, 2024

Conversation

jmuzina
Copy link
Member

@jmuzina jmuzina commented Jun 6, 2024

Done

Updates the card component to use new color theme variables & thus support theming.

Note that the image used in the header example was changed as the old one is not friendly to all themes (dark text becomes impossible to read on dark theme)

Fixes WD-11865

QA

Check if PR is ready for release

If this PR contains Vanilla SCSS code changes, it should contain the following changes to make sure it's ready for the release:

  • PR should have one of the following labels to automatically categorise it in release notes:
    • Feature 🎁, Breaking Change 💣, Bug 🐛, Documentation 📝, Maintenance 🔨.
  • Vanilla version in package.json should be updated relative to the most recent release, following semver convention:
    • if CSS class names are not changed it can be bugfix relesase (x.x.X)
    • if CSS class names are changed/added/removed it should be minor version (x.X.0)
    • see the wiki for more details
  • Any changes to component class names (new patterns, variants, removed or added features) should be listed on the what's new page.

Screenshots

Default light:
image
Default dark:
image
Default paper:
image

Content bleed light:
image
Content bleed dark:
image
Content bleed paper:
image

Header light:
image
Header dark:
image
Header paper:
image

Highlighted light:
image
Highlighted dark:
image
Highlighted paper:
image

Image light:
image
Image dark:
image
Image paper:
image

Overlay light:
image
Overlay dark:
image
Overlay paper:
image

@webteam-app
Copy link

@jmuzina jmuzina added the Review: Percy needed This PR needs a review of Percy for visual regressions label Jun 6, 2024
@jmuzina jmuzina marked this pull request as ready for review June 6, 2024 16:10
@jmuzina jmuzina marked this pull request as draft June 6, 2024 16:41
@jmuzina
Copy link
Member Author

jmuzina commented Jun 6, 2024

FYI, this causes changes to some other examples that used card; the card section of the example now uses the theme of the example, rather than always being light theme.

I initially thought this was a Percy bug (and opened #5114 ) but this is expected :)

@jmuzina jmuzina marked this pull request as ready for review June 6, 2024 17:05
@jmuzina
Copy link
Member Author

jmuzina commented Jun 6, 2024

@lyubomir-popov Please give a design review when you have the time!

@lyubomir-popov
Copy link
Contributor

Nothing looks broken to me, so +1. Iwonder whether we need all this though - the closest we come to cards in the rebranded pages are these two examples, and both have no borders or shadows, just the indent.

image
image

Maybe it's time to deprecate all other versions of the card - unless they are used in products:

@bartaz
Copy link
Member

bartaz commented Jun 7, 2024

We "need" this just for the sake of consistency. Current cards would break on dark theme (components used in them would use white text). So we need them to at least be not broken, and use theme colours instead of hardcoded ones.

So it's just a minimal work to achieve that.

But overall at some point we should do a review of Vanilla components and properly identify the ones we want to deprecate.

@bartaz
Copy link
Member

bartaz commented Jun 11, 2024

It seems that border around card is still hardcoded into a single colour, because it's extended out of %vf-is-bordered that is using $border that is not themed.

@jmuzina
Copy link
Member Author

jmuzina commented Jun 11, 2024

It seems that border around card is still hardcoded into a single colour, because it's extended out of %vf-is-bordered that is using $border that is not themed.

@bartaz I've revised this to use 1px solid $colors--theme--border-default

@bartaz
Copy link
Member

bartaz commented Jun 11, 2024

It seems that border around card is still hardcoded into a single colour, because it's extended out of %vf-is-bordered that is using $border that is not themed.

@bartaz I've revised this to use 1px solid $colors--theme--border-default

Thanks, but it would be good to update the %vf-is-bordered to be themed as well, as this may fix any other places that use these borders consistently (and that's what we eventually need anyway).

Or, to be specific, the $border variable should be updated to use themed colour, which would hopefully mean all the places where it is used are updated all together.

@jmuzina
Copy link
Member Author

jmuzina commented Jun 11, 2024

update the %vf-is-bordered to be themed as well, as this may fix any other places that use these borders consistently (and that's what we eventually need anyway).

@bartaz Done! Let's see what Percy thinks about this, hopefully many things get fixed

@bartaz
Copy link
Member

bartaz commented Jun 11, 2024

update the %vf-is-bordered to be themed as well, as this may fix any other places that use these borders consistently (and that's what we eventually need anyway).

@bartaz Done! Let's see what Percy thinks about this, hopefully many things get fixed

If the colour change is subtle it may not even notice ;)

@jmuzina
Copy link
Member Author

jmuzina commented Jun 11, 2024

update the %vf-is-bordered to be themed as well, as this may fix any other places that use these borders consistently (and that's what we eventually need anyway).

@bartaz Done! Let's see what Percy thinks about this, hopefully many things get fixed

If the colour change is subtle it may not even notice ;)
@bartaz
Percy build is looking good!

@@ -5,7 +5,7 @@

{% block content %}
<div class="p-card">
<img class="p-card__thumbnail" src="https://assets.ubuntu.com/v1/dca2e4c4-raspberry-logo.png" alt="" />
<img class="p-card__thumbnail" src="https://assets.ubuntu.com/v1/8fdc8250-Ubuntu+and+Raspberry+Pi.svg" alt="" />
Copy link
Member

Choose a reason for hiding this comment

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

Why the image change?

Copy link
Member Author

@jmuzina jmuzina Jun 11, 2024

Choose a reason for hiding this comment

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

@bartaz Updated image looks better on dark theme as it has no dark text
Before (dark theme):
image
After (dark theme):
image
Although, the plus icon here is still kind of hard to see in dark theme. Is this the kind of thing that we care about changing now that we're updating components to support theming?

@@ -5,7 +5,7 @@
$input-border-thickness: 1.5px;
$bar-thickness: 0.1875rem !default; // 3px at 16px fontsize, expressed in rems so it scales with text if the root font-size changes at a breakpoint
$border-radius: 0; // deprecated, will be removed in future version of Vanilla
$border: $input-border-thickness solid $color-mid-light !default;
$border: 1px solid $colors--theme--border-default !default;
Copy link
Member

Choose a reason for hiding this comment

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

Keep the border thickness as it was before, just update the colour, please.

@bartaz bartaz merged commit 3509ae8 into canonical:main Jun 12, 2024
6 checks passed
@jmuzina jmuzina deleted the card-pattern-theming branch June 12, 2024 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants