Skip to content
This repository was archived by the owner on Nov 6, 2024. It is now read-only.

Commit df2183e

Browse files
committed
feat: appearance changed on colors component
1 parent be7cd42 commit df2183e

File tree

3 files changed

+44
-36
lines changed

3 files changed

+44
-36
lines changed
Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
11
@use 'colors-used' as *;
22

33
// These styles only affect the colors "Usage" page in the component library
4-
.cl-colors {
5-
padding: 1rem;
6-
}
7-
84
.cl-colors__list {
95
display: flex;
106
flex-wrap: wrap;
11-
margin: 0 0 2rem;
127
padding: 0;
8+
margin: 0 0 space(2);
139
}
1410

1511
.cl-colors__item {
16-
list-style: none;
17-
padding: 1rem 2rem;
18-
transition: all 0.4s;
19-
flex: 1 1 20%;
20-
min-width: 150px;
21-
min-height: 150px;
2212
display: flex;
23-
justify-content: center;
24-
align-items: flex-end;
13+
flex-direction: column;
14+
padding: $space;
15+
max-width: 13rem;
16+
font-size: $space;
17+
list-style: none;
18+
}
19+
20+
.cl-colors__title {
21+
font-weight: bold;
22+
margin: $space 0 0;
23+
}
24+
25+
.cl-colors__swatch {
26+
display: block;
27+
width: 11rem;
28+
height: 6rem;
2529
}
2630

2731
// Dynamically set swatch text color based on the lightness of the background color
@@ -40,19 +44,17 @@
4044
// Style default color swatches
4145
@each $name, $color in $defaultColors {
4246
.cl-colors__item--default {
43-
&-#{$name} {
47+
&-#{$name} .cl-colors__swatch {
4448
background-color: clr($name);
45-
color: set-color($color);
4649
}
4750
}
4851
}
4952

5053
// Style dark color swatches
5154
@each $name, $color in $darkColors {
5255
.cl-colors__item--dark {
53-
&-#{$name} {
56+
&-#{$name} .cl-colors__swatch {
5457
background-color: clr($name);
55-
color: set-color($color, muted, accent-high);
5658
}
5759
}
5860
}

components/00-base/01-colors/colors.stories.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import colors from './colors.twig';
22

33
import colorsData from './colors.yml';
4+
import './colors';
45

56
/**
67
* Storybook Definition.

components/00-base/01-colors/colors.twig

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,28 @@
55
heading_level: 2,
66
heading: colors_heading,
77
} %}
8-
9-
{% for palette in palettes %}
10-
{% set palette_machine = palette.palette_heading|lower %}
11-
{% include "@atoms/text/headings/_heading.twig" with {
12-
heading_level: 3,
13-
heading: palette.palette_heading,
14-
} %}
15-
<ul {{ bem('list', [palette_machine], colors_base_class) }} data-theme="{{ palette_machine }}">
16-
{% for color in palette.colors %}
17-
{% set color_machine = color.name|lower|replace({' ': '-'}) %}
18-
{% if color.color_reverse == TRUE %}
19-
{% set colors_title_modifiers = ['reverse'] %}
20-
{% endif %}
21-
<li {{ bem("item", [palette_machine ~ '-' ~ color_machine], colors_base_class) }}>
22-
<span {{ bem("title", colors_title_modifiers, colors_base_class) }}>{{ color.name }}</span> <br/>
23-
</li>
24-
{% endfor %}
25-
</ul>
26-
{% endfor %}
8+
<ul>
9+
{% for palette in palettes %}
10+
{% set palette_machine = palette.palette_heading|lower %}
11+
{% include "@atoms/text/headings/_heading.twig" with {
12+
heading_level: 3,
13+
heading: palette.palette_heading,
14+
} %}
15+
<ul {{ bem('list', [palette_machine], colors_base_class) }} data-theme="{{ palette_machine }}">
16+
{% for color in palette.colors %}
17+
{% set color_machine = color.name|lower|replace({' ': '-'}) %}
18+
{% if color.color_reverse == TRUE %}
19+
{% set colors_title_modifiers = ['reverse'] %}
20+
{% endif %}
21+
<li {{ bem("item", [palette_machine ~ '-' ~ color_machine], colors_base_class) }}>
22+
<span {{ bem("swatch", [], colors_base_class) }}></span>
23+
<span {{ bem("title", colors_title_modifiers, colors_base_class) }}>
24+
{{ color.name }}
25+
</span>
26+
<span {{ bem("definition", [], colors_base_class) }}></span>
27+
</li>
28+
{% endfor %}
29+
</ul>
30+
{% endfor %}
31+
</ul>
2732
</div>

0 commit comments

Comments
 (0)