From b3904200101472ee58037294902d419de3f11edc Mon Sep 17 00:00:00 2001 From: Maximilian Franzke <787658+mfranzke@users.noreply.github.com> Date: Fri, 29 Sep 2023 15:02:41 +0200 Subject: [PATCH] fix: possibility to define two icons on an element again (#588) --- .../00-base/icons/_icons.attributes-mappings.scss | 8 +++----- source/_patterns/00-base/icons/_icons.helpers.scss | 5 +++-- source/_patterns/00-base/icons/icons.scss | 2 ++ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/source/_patterns/00-base/icons/_icons.attributes-mappings.scss b/source/_patterns/00-base/icons/_icons.attributes-mappings.scss index 459eaf5665..e9cef91635 100644 --- a/source/_patterns/00-base/icons/_icons.attributes-mappings.scss +++ b/source/_patterns/00-base/icons/_icons.attributes-mappings.scss @@ -4,11 +4,9 @@ @each $icon-name, $icon-glyph in $icon-glyphs { [data-icon="#{$icon-name}"], [data-icon-before="#{$icon-name}"] { - &::before { - --icon-glyph: "#{$icon-glyph}"; - } + --icon-glyph-before: "#{$icon-glyph}"; } - [data-icon-after="#{$icon-name}"]::after { - --icon-glyph: "#{$icon-glyph}"; + [data-icon-after="#{$icon-name}"] { + --icon-glyph-after: "#{$icon-glyph}"; } } diff --git a/source/_patterns/00-base/icons/_icons.helpers.scss b/source/_patterns/00-base/icons/_icons.helpers.scss index 4ec8de0afd..bb9043e2fe 100644 --- a/source/_patterns/00-base/icons/_icons.helpers.scss +++ b/source/_patterns/00-base/icons/_icons.helpers.scss @@ -8,7 +8,7 @@ ) { // We're setting this on the parent tag, so that it could get overwritten via data-icon=* @if $glyph != "" { - --icon-glyph: "#{$glyph}"; + --icon-glyph-#{$position}: "#{$glyph}"; } &::#{$position} { @@ -30,8 +30,9 @@ ); } + content: var(--icon-glyph-#{$position}); + @if $partial { - content: var(--icon-glyph); display: inline-block; /*** icon - partial ***/ // * use !important to prevent issues with browser extensions that change fonts diff --git a/source/_patterns/00-base/icons/icons.scss b/source/_patterns/00-base/icons/icons.scss index 666517a1fa..1db0240ed5 100644 --- a/source/_patterns/00-base/icons/icons.scss +++ b/source/_patterns/00-base/icons/icons.scss @@ -11,6 +11,7 @@ [data-icon-before] { &::before { @extend %icon; + content: var(--icon-glyph-before); margin-inline-end: var(--icon-margin-after, #{$icon-content-space}); font-size: var( --icon-font-size-before, @@ -22,6 +23,7 @@ [data-icon-after] { &::after { @extend %icon; + content: var(--icon-glyph-after); margin-inline-start: var(--icon-margin-before, #{$icon-content-space}); font-size: var( --icon-font-size-after,