Skip to content

Commit 2e6ec87

Browse files
committed
refactor: icon margins and aligned icons margins CSS variables
1 parent 206d7c0 commit 2e6ec87

File tree

9 files changed

+37
-27
lines changed

9 files changed

+37
-27
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ In general we've introduced the possibility to control variants and configuratio
8080
- The DB Webfonts files have been updated -->
8181

8282
## [Unreleased]
83+
## [2.0.0-46] - 2022-07-13
84+
85+
### Changed
86+
87+
#### Package consumption
88+
89+
- **BREAKING CHANGE** / Icons: Changed undocumented CSS Variables `--icon-margin-left` and `--icon-margin-right` to `--icon-margin-before` and `--icon-margin-after`
90+
- refactor: icon margins
91+
8392
## [2.0.0-45] - 2022-07-07
8493

8594
### Fixed

docs/migrationGuide.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ The already deprecated enterprise specific as well as the seperate transporation
5555

5656
And we've moved all icon assets from `dist/images/icons` to `dist/icons` and even a better subfolder structure in there, and as well retrieving those by [DB UI Base](https://db-ui.github.io/base/?p=viewall-icons-all) package, path `node_modules/@db-ui/base/build/assets/icons/`.
5757

58+
If you've used the undocumented `--icon-margin-left` and `--icon-margin-right` CSS Variables: They now became `--icon-margin-before` and `--icon-margin-after` for easier i18n.
59+
5860
=== Buttons
5961

6062
Some variants have changed or been removed:

source/_patterns/00-base/icons/_icons.helpers.scss

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@
77
$partial: false
88
) {
99
&::#{$position} {
10-
--icon-font-family: "#{"icons-" + $size + "-" + $style}", "missing-icons" !important;
10+
--icon-font-family: "#{"icons-" + $size + "-" + $style}",
11+
"missing-icons" !important;
1112
--icon-font-size: #{to-rem($pxValue: $size)};
1213

1314
@if $position == "before" {
14-
--icon-margin-right: #{$icon-content-space};
15+
margin-inline-end: var(--icon-margin-after, #{$icon-content-space});
1516
}
1617
@if $position == "after" {
17-
--icon-margin-left: #{$icon-content-space};
18+
margin-inline-start: var(
19+
--icon-margin-before,
20+
#{$icon-content-space}
21+
);
1822
}
1923

2024
@if $glyph != "" {
@@ -40,9 +44,6 @@
4044

4145
display: inline-block;
4246

43-
margin-right: var(--icon-margin-right);
44-
margin-left: var(--icon-margin-left);
45-
4647
// * Better Font Rendering ===========
4748
-webkit-font-smoothing: antialiased;
4849
-moz-osx-font-smoothing: grayscale;
@@ -72,11 +73,11 @@
7273

7374
@if $position == "before" {
7475
&::before {
75-
--icon-margin-right: 0;
76+
--icon-margin-after: 0;
7677
}
7778
} @else {
7879
&::after {
79-
--icon-margin-left: 0;
80+
--icon-margin-before: 0;
8081
}
8182
}
8283
}
@@ -89,7 +90,8 @@
8990
// Icon meta data mixin
9091
@mixin iconMeta($size: $icon-size, $style: $icon-style, $position: "before") {
9192
&::#{$position} {
92-
--icon-font-family: "#{"icons-" + $size + "-" + $style}", "missing-icons" !important;
93+
--icon-font-family: "#{"icons-" + $size + "-" + $style}",
94+
"missing-icons" !important;
9395
--icon-font-size: #{to-rem($pxValue: $size)};
9496
}
9597
}

source/_patterns/00-base/icons/_icons.placeholder.scss

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818

1919
display: inline-block;
2020

21-
margin-right: var(--icon-margin-right);
22-
margin-left: var(--icon-margin-left);
23-
2421
// * Better Font Rendering ===========
2522
-webkit-font-smoothing: antialiased;
2623
-moz-osx-font-smoothing: grayscale;

source/_patterns/00-base/icons/_icons.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
[data-icon],
1010
[data-icon-before] {
1111
&::before {
12-
--icon-margin-right: #{$icon-content-space};
12+
margin-inline-end: var(--icon-margin-after, #{$icon-content-space});
1313
@extend %icon;
1414
}
1515
}
1616
[data-icon-after] {
1717
&::after {
18-
--icon-margin-left: #{$icon-content-space};
18+
margin-inline-start: var(--icon-margin-before, #{$icon-content-space});
1919
@extend %icon;
2020
}
2121
}

source/_patterns/01-elements/tags/tag.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,14 @@
8686
@include iconMeta(20);
8787

8888
&::before {
89-
--icon-margin-right: #{to-rem($pxValue: 2)};
89+
--icon-margin-after: #{to-rem($pxValue: 2)};
9090
}
9191
}
9292
&[data-icon-after] {
9393
@include iconMeta($size: 20, $position: "after");
9494

9595
&::after {
96-
--icon-margin-left: #{to-rem($pxValue: 2)};
96+
--icon-margin-before: #{to-rem($pxValue: 2)};
9797
}
9898
}
9999
}

source/_patterns/02-components/accordion/accordion.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030

3131
// Icon horizontal space
3232
&::before {
33-
--icon-margin-left: #{to-rem($pxValue: 14)};
34-
--icon-margin-right: #{to-rem($pxValue: 8)};
33+
margin-left: #{to-rem($pxValue: 14)};
34+
--icon-margin-after: #{to-rem($pxValue: 8)};
3535
}
3636

3737
& + p {
@@ -79,8 +79,8 @@
7979

8080
&::before {
8181
--icon-font-size: #{to-rem($pxValue: 20)};
82-
--icon-margin-left: #{to-rem($pxValue: 6)};
83-
--icon-margin-right: #{to-rem($pxValue: 6)};
82+
margin-left: #{to-rem($pxValue: 6)};
83+
--icon-margin-after: #{to-rem($pxValue: 6)};
8484
}
8585
}
8686
}

source/_patterns/02-components/breadcrumb/breadcrumb.scss

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
.elm-link {
2727
text-decoration: none;
2828

29-
padding: to-rem($pxValue: 1) to-rem($pxValue: 3) to-rem($pxValue: 1)
30-
to-rem($pxValue: 4);
29+
padding: to-rem($pxValue: 1) to-rem($pxValue: 3)
30+
to-rem($pxValue: 1) to-rem($pxValue: 4);
3131

3232
border-radius: to-rem($pxValue: 4);
3333

@@ -42,7 +42,7 @@
4242
&:first-child {
4343
@include icon(glyph(home), $size: 20, $partial: $partial);
4444
&::before {
45-
--icon-margin-right: #{to-rem($pxValue: 3)};
45+
--icon-margin-after: #{to-rem($pxValue: 3)};
4646
}
4747
}
4848

@@ -55,8 +55,8 @@
5555

5656
&::before {
5757
--icon-font-size: #{to-rem($pxValue: 14)};
58-
--icon-margin-right: 0;
59-
--icon-margin-left: -#{to-rem($pxValue: 2)};
58+
--icon-margin-after: 0;
59+
margin-left: -#{to-rem($pxValue: 2)};
6060
color: $db-color-cool-gray-400;
6161
}
6262
}

source/_patterns/02-components/notifications/notification.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@
6464
&[data-icon],
6565
&[data-icon-before] {
6666
&::before {
67-
--icon-margin-right: #{to-rem($pxValue: 10)};
67+
--icon-margin-after: #{to-rem($pxValue: 10)};
6868
}
6969
}
7070
&[data-icon-after] {
7171
justify-content: space-between;
7272
&::after {
73-
--icon-margin-left: #{to-rem($pxValue: 10)};
73+
--icon-margin-before: #{to-rem($pxValue: 10)};
7474
}
7575
}
7676
}

0 commit comments

Comments
 (0)