diff options
| author | Volpeon <git@volpeon.ink> | 2025-11-08 11:50:57 +0100 |
|---|---|---|
| committer | Volpeon <git@volpeon.ink> | 2025-11-08 11:50:57 +0100 |
| commit | 990a2cd28ed8814442546c749c35c63f231df59d (patch) | |
| tree | 277b31bf20f049aca2fa596ce0251b6a26f95e79 | |
| parent | Heading typography (diff) | |
| download | iro-design-990a2cd28ed8814442546c749c35c63f231df59d.tar.gz iro-design-990a2cd28ed8814442546c749c35c63f231df59d.tar.bz2 iro-design-990a2cd28ed8814442546c749c35c63f231df59d.zip | |
Heading: Add static theme colors
| -rw-r--r-- | src/objects/_heading.scss | 22 | ||||
| -rw-r--r-- | src/objects/_heading.vars.scss | 54 | ||||
| -rw-r--r-- | src/scopes/_headings.scss | 21 | ||||
| -rw-r--r-- | tpl/objects/heading.pug | 56 | ||||
| -rw-r--r-- | tpl/views/heading.pug | 44 |
5 files changed, 190 insertions, 7 deletions
diff --git a/src/objects/_heading.scss b/src/objects/_heading.scss index 2d27658..1d6e2dc 100644 --- a/src/objects/_heading.scss +++ b/src/objects/_heading.scss | |||
| @@ -1,4 +1,6 @@ | |||
| 1 | @use 'sass:map'; | ||
| 1 | @use 'sass:meta'; | 2 | @use 'sass:meta'; |
| 3 | @use 'sass:string'; | ||
| 2 | @use 'iro-sass/src/bem'; | 4 | @use 'iro-sass/src/bem'; |
| 3 | @use 'iro-sass/src/props'; | 5 | @use 'iro-sass/src/props'; |
| 4 | @use '../props' as *; | 6 | @use '../props' as *; |
| @@ -60,5 +62,25 @@ | |||
| 60 | } | 62 | } |
| 61 | } | 63 | } |
| 62 | } | 64 | } |
| 65 | |||
| 66 | @each $theme in map.keys(props.get(vars.$static-themes)) { | ||
| 67 | @include bem.modifier(string.slice($theme, 3)) { | ||
| 68 | color: props.get(vars.$static-themes, $theme, --text-color); | ||
| 69 | |||
| 70 | @each $mod, $value in vars.$sizes { | ||
| 71 | @include bem.modifier($mod) { | ||
| 72 | color: props.get(vars.$static-themes, $theme, --#{$mod}, --text-color); | ||
| 73 | } | ||
| 74 | } | ||
| 75 | |||
| 76 | @include bem.modifier('display') { | ||
| 77 | @each $mod, $value in vars.$sizes { | ||
| 78 | @include bem.modifier($mod) { | ||
| 79 | color: props.get(vars.$static-themes, $theme, --display, --#{$mod}, --text-color); | ||
| 80 | } | ||
| 81 | } | ||
| 82 | } | ||
| 83 | } | ||
| 84 | } | ||
| 63 | } | 85 | } |
| 64 | } | 86 | } |
diff --git a/src/objects/_heading.vars.scss b/src/objects/_heading.vars.scss index ccef017..cf07488 100644 --- a/src/objects/_heading.vars.scss +++ b/src/objects/_heading.vars.scss | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | @use 'sass:map'; | ||
| 2 | @use 'sass:string'; | ||
| 1 | @use 'iro-sass/src/props'; | 3 | @use 'iro-sass/src/props'; |
| 2 | @use '../core.vars' as core; | 4 | @use '../core.vars' as core; |
| 3 | 5 | ||
| @@ -151,3 +153,55 @@ $display--sizes: ( | |||
| 151 | 'xl' $display--font-family--xl $display--line-height--xl $display--font-size--xl $display--font-weight--xl $display--letter-spacing--xl $display--feature-settings--xl $display--text-transform--xl $display--text-color--xl, | 153 | 'xl' $display--font-family--xl $display--line-height--xl $display--font-size--xl $display--font-weight--xl $display--letter-spacing--xl $display--feature-settings--xl $display--text-transform--xl $display--text-color--xl, |
| 152 | 'xxl' $display--font-family--xxl $display--line-height--xxl $display--font-size--xxl $display--font-weight--xxl $display--letter-spacing--xxl $display--feature-settings--xxl $display--text-transform--xxl $display--text-color--xxl, | 154 | 'xxl' $display--font-family--xxl $display--line-height--xxl $display--font-size--xxl $display--font-weight--xxl $display--letter-spacing--xxl $display--feature-settings--xxl $display--text-transform--xxl $display--text-color--xxl, |
| 153 | ) !default; | 155 | ) !default; |
| 156 | |||
| 157 | $static-themes: props.def(--o-heading, (), 'color'); | ||
| 158 | |||
| 159 | @each $theme in map.keys(props.get(core.$transparent-colors)) { | ||
| 160 | $heading-theme: --static-#{string.slice($theme, 3)}; | ||
| 161 | |||
| 162 | $static-themes: props.merge($static-themes, ( | ||
| 163 | $heading-theme: ( | ||
| 164 | --text-color: props.get(core.$transparent-colors, $theme, --900), | ||
| 165 | |||
| 166 | --xxl: ( | ||
| 167 | --text-color: props.get(core.$transparent-colors, $theme, --900), | ||
| 168 | ), | ||
| 169 | --xl: ( | ||
| 170 | --text-color: props.get(core.$transparent-colors, $theme, --900), | ||
| 171 | ), | ||
| 172 | --lg: ( | ||
| 173 | --text-color: props.get(core.$transparent-colors, $theme, --900), | ||
| 174 | ), | ||
| 175 | --md: ( | ||
| 176 | --text-color: props.get(core.$transparent-colors, $theme, --900), | ||
| 177 | ), | ||
| 178 | --sm: ( | ||
| 179 | --text-color: props.get(core.$transparent-colors, $theme, --500), | ||
| 180 | ), | ||
| 181 | --xs: ( | ||
| 182 | --text-color: props.get(core.$transparent-colors, $theme, --500), | ||
| 183 | ), | ||
| 184 | |||
| 185 | --display: ( | ||
| 186 | --xxl: ( | ||
| 187 | --text-color: props.get(core.$transparent-colors, $theme, --900), | ||
| 188 | ), | ||
| 189 | --xl: ( | ||
| 190 | --text-color: props.get(core.$transparent-colors, $theme, --900), | ||
| 191 | ), | ||
| 192 | --lg: ( | ||
| 193 | --text-color: props.get(core.$transparent-colors, $theme, --900), | ||
| 194 | ), | ||
| 195 | --md: ( | ||
| 196 | --text-color: props.get(core.$transparent-colors, $theme, --900), | ||
| 197 | ), | ||
| 198 | --sm: ( | ||
| 199 | --text-color: props.get(core.$transparent-colors, $theme, --900), | ||
| 200 | ), | ||
| 201 | --xs: ( | ||
| 202 | --text-color: props.get(core.$transparent-colors, $theme, --500), | ||
| 203 | ), | ||
| 204 | ), | ||
| 205 | ) | ||
| 206 | )); | ||
| 207 | } | ||
diff --git a/src/scopes/_headings.scss b/src/scopes/_headings.scss index 0a56ef1..362b116 100644 --- a/src/scopes/_headings.scss +++ b/src/scopes/_headings.scss | |||
| @@ -1,4 +1,5 @@ | |||
| 1 | @use 'sass:map'; | 1 | @use 'sass:map'; |
| 2 | @use 'sass:string'; | ||
| 2 | @use 'iro-sass/src/bem'; | 3 | @use 'iro-sass/src/bem'; |
| 3 | @use 'iro-sass/src/props'; | 4 | @use 'iro-sass/src/props'; |
| 4 | @use '../objects/heading.vars' as heading; | 5 | @use '../objects/heading.vars' as heading; |
| @@ -67,5 +68,25 @@ | |||
| 67 | } | 68 | } |
| 68 | } | 69 | } |
| 69 | } | 70 | } |
| 71 | |||
| 72 | @each $theme in map.keys(props.get(heading.$static-themes)) { | ||
| 73 | @include bem.modifier(string.slice($theme, 3)) { | ||
| 74 | color: props.get(heading.$static-themes, $theme, --text-color); | ||
| 75 | |||
| 76 | @each $mod, $value in heading.$sizes { | ||
| 77 | #{map.get($-size-map, $mod)} { | ||
| 78 | color: props.get(heading.$static-themes, $theme, --#{$mod}, --text-color); | ||
| 79 | } | ||
| 80 | } | ||
| 81 | |||
| 82 | @include bem.modifier('display') { | ||
| 83 | @each $mod, $value in heading.$sizes { | ||
| 84 | #{map.get($-size-map, $mod)} { | ||
| 85 | color: props.get(heading.$static-themes, $theme, --display, --#{$mod}, --text-color); | ||
| 86 | } | ||
| 87 | } | ||
| 88 | } | ||
| 89 | } | ||
| 90 | } | ||
| 70 | } | 91 | } |
| 71 | } | 92 | } |
diff --git a/tpl/objects/heading.pug b/tpl/objects/heading.pug index 6cc05ad..cdc28f0 100644 --- a/tpl/objects/heading.pug +++ b/tpl/objects/heading.pug | |||
| @@ -1,34 +1,76 @@ | |||
| 1 | mixin h1-heading(level, display = false) | 1 | mixin h1-heading(level, display = false) |
| 2 | - let classes = ['o-heading', 'o-heading--' + level, { 'o-heading--display': display }] | 2 | - |
| 3 | let classes = [ | ||
| 4 | 'o-heading', | ||
| 5 | 'o-heading--' + level, | ||
| 6 | 'o-heading--' + attributes.color, | ||
| 7 | { 'o-heading--display': display } | ||
| 8 | ] | ||
| 3 | h1(class=classes)&attributes(attributes) | 9 | h1(class=classes)&attributes(attributes) |
| 4 | block | 10 | block |
| 5 | 11 | ||
| 6 | mixin h2-heading(level, display = false) | 12 | mixin h2-heading(level, display = false) |
| 7 | - let classes = ['o-heading', 'o-heading--' + level, { 'o-heading--display': display }] | 13 | - |
| 14 | let classes = [ | ||
| 15 | 'o-heading', | ||
| 16 | 'o-heading--' + level, | ||
| 17 | 'o-heading--' + attributes.color, | ||
| 18 | { 'o-heading--display': display } | ||
| 19 | ] | ||
| 8 | h2(class=classes)&attributes(attributes) | 20 | h2(class=classes)&attributes(attributes) |
| 9 | block | 21 | block |
| 10 | 22 | ||
| 11 | mixin h3-heading(level, display = false) | 23 | mixin h3-heading(level, display = false) |
| 12 | - let classes = ['o-heading', 'o-heading--' + level, { 'o-heading--display': display }] | 24 | - |
| 25 | let classes = [ | ||
| 26 | 'o-heading', | ||
| 27 | 'o-heading--' + level, | ||
| 28 | 'o-heading--' + attributes.color, | ||
| 29 | { 'o-heading--display': display } | ||
| 30 | ] | ||
| 13 | h3(class=classes)&attributes(attributes) | 31 | h3(class=classes)&attributes(attributes) |
| 14 | block | 32 | block |
| 15 | 33 | ||
| 16 | mixin h4-heading(level, display = false) | 34 | mixin h4-heading(level, display = false) |
| 17 | - let classes = ['o-heading', 'o-heading--' + level, { 'o-heading--display': display }] | 35 | - |
| 36 | let classes = [ | ||
| 37 | 'o-heading', | ||
| 38 | 'o-heading--' + level, | ||
| 39 | 'o-heading--' + attributes.color, | ||
| 40 | { 'o-heading--display': display } | ||
| 41 | ] | ||
| 18 | h4(class=classes)&attributes(attributes) | 42 | h4(class=classes)&attributes(attributes) |
| 19 | block | 43 | block |
| 20 | 44 | ||
| 21 | mixin h5-heading(level, display = false) | 45 | mixin h5-heading(level, display = false) |
| 22 | - let classes = ['o-heading', 'o-heading--' + level, { 'o-heading--display': display }] | 46 | - |
| 47 | let classes = [ | ||
| 48 | 'o-heading', | ||
| 49 | 'o-heading--' + level, | ||
| 50 | 'o-heading--' + attributes.color, | ||
| 51 | { 'o-heading--display': display } | ||
| 52 | ] | ||
| 23 | h5(class=classes)&attributes(attributes) | 53 | h5(class=classes)&attributes(attributes) |
| 24 | block | 54 | block |
| 25 | 55 | ||
| 26 | mixin h6-heading(level, display = false) | 56 | mixin h6-heading(level, display = false) |
| 27 | - let classes = ['o-heading', 'o-heading--' + level, { 'o-heading--display': display }] | 57 | - |
| 58 | let classes = [ | ||
| 59 | 'o-heading', | ||
| 60 | 'o-heading--' + level, | ||
| 61 | 'o-heading--' + attributes.color, | ||
| 62 | { 'o-heading--display': display } | ||
| 63 | ] | ||
| 28 | h6(class=classes)&attributes(attributes) | 64 | h6(class=classes)&attributes(attributes) |
| 29 | block | 65 | block |
| 30 | 66 | ||
| 31 | mixin div-heading(level, display = false) | 67 | mixin div-heading(level, display = false) |
| 32 | - let classes = ['o-heading', 'o-heading--' + level, { 'o-heading--display': display }] | 68 | - |
| 69 | let classes = [ | ||
| 70 | 'o-heading', | ||
| 71 | 'o-heading--' + level, | ||
| 72 | 'o-heading--' + attributes.color, | ||
| 73 | { 'o-heading--display': display } | ||
| 74 | ] | ||
| 33 | div(class=classes)&attributes(attributes) | 75 | div(class=classes)&attributes(attributes) |
| 34 | block | 76 | block |
diff --git a/tpl/views/heading.pug b/tpl/views/heading.pug index bc16cee..35c4de4 100644 --- a/tpl/views/heading.pug +++ b/tpl/views/heading.pug | |||
| @@ -39,3 +39,47 @@ mixin view-heading | |||
| 39 | +div-heading('md', true)= 'MD display Heading' | 39 | +div-heading('md', true)= 'MD display Heading' |
| 40 | +div-heading('sm', true)= 'SM display Heading' | 40 | +div-heading('sm', true)= 'SM display Heading' |
| 41 | +div-heading('xs', true)= 'XS display Heading' | 41 | +div-heading('xs', true)= 'XS display Heading' |
| 42 | |||
| 43 | each theme in ['static-black', 'static-white'] | ||
| 44 | - | ||
| 45 | const bg = theme.startsWith('static-black') ? 500 : 1000; | ||
| 46 | |||
| 47 | .c-box(style=`background-color: var(--colors--blue-static--${bg});`) | ||
| 48 | h1.u-mt-0= 'H1 default' | ||
| 49 | h2= 'H2 default' | ||
| 50 | h3= 'H3 default' | ||
| 51 | h4= 'H4 default' | ||
| 52 | h5= 'H5 default' | ||
| 53 | h6= 'H6 default' | ||
| 54 | |||
| 55 | .c-box.s-headings(class=`s-headings--${theme}` style=`background-color: var(--colors--blue-static--${bg});`) | ||
| 56 | h1.u-mt-0= 'H1 styled' | ||
| 57 | h2= 'H2 styled' | ||
| 58 | h3= 'H3 styled' | ||
| 59 | h4= 'H4 styled' | ||
| 60 | h5= 'H5 styled' | ||
| 61 | h6= 'H6 styled' | ||
| 62 | |||
| 63 | .c-box.s-headings.s-headings--display(class=`s-headings--${theme}` style=`background-color: var(--colors--blue-static--${bg});`) | ||
| 64 | h1.u-mt-0= 'H1 display styled' | ||
| 65 | h2= 'H2 display styled' | ||
| 66 | h3= 'H3 display styled' | ||
| 67 | h4= 'H4 display styled' | ||
| 68 | h5= 'H5 display styled' | ||
| 69 | h6= 'H6 display styled' | ||
| 70 | |||
| 71 | .c-box(style=`background-color: var(--colors--blue-static--${bg});`) | ||
| 72 | +div-heading('xxl')(color=theme class='u-mt-0')= 'XXL Heading' | ||
| 73 | +div-heading('xl')(color=theme)= 'XL Heading' | ||
| 74 | +div-heading('lg')(color=theme)= 'LG Heading' | ||
| 75 | +div-heading('md')(color=theme)= 'MD Heading' | ||
| 76 | +div-heading('sm')(color=theme)= 'SM Heading' | ||
| 77 | +div-heading('xs')(color=theme)= 'XS Heading' | ||
| 78 | |||
| 79 | .c-box(style=`background-color: var(--colors--blue-static--${bg});`) | ||
| 80 | +div-heading('xxl', true)(color=theme class='u-mt-0')= 'XXL display Heading' | ||
| 81 | +div-heading('xl', true)(color=theme)= 'XL display Heading' | ||
| 82 | +div-heading('lg', true)(color=theme)= 'LG display Heading' | ||
| 83 | +div-heading('md', true)(color=theme)= 'MD display Heading' | ||
| 84 | +div-heading('sm', true)(color=theme)= 'SM display Heading' | ||
| 85 | +div-heading('xs', true)(color=theme)= 'XS display Heading' | ||
