Skip to content

Commit

Permalink
refactor: fix scss warnings (#900)
Browse files Browse the repository at this point in the history
* refactor: fix scss warnings

* refactor: fix scss warnings

* refactor: fix scss warnings

* refactor: fix scss warnings

* refactor: fix scss warnings
  • Loading branch information
mfranzke authored Jul 24, 2024
1 parent f44c861 commit 530d829
Show file tree
Hide file tree
Showing 13 changed files with 117 additions and 80 deletions.
56 changes: 31 additions & 25 deletions source/_patterns/00-base/icons/_icons.helpers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
) {
// We're setting this on the parent tag, so that it could get overwritten via data-icon=*
@if $glyph != "" {
--icon-glyph-#{$position}: "#{$glyph}";
& {
--icon-glyph-#{$position}: "#{$glyph}";
}
}

&::#{$position} {
Expand Down Expand Up @@ -37,32 +39,34 @@
}

@if $partial {
display: inline-block;
/*** icon - partial ***/
// * use !important to prevent issues with browser extensions that change fonts
font-family: var(--icon-font-family) !important;
font-style: normal;
font-variant: normal;
& {
display: inline-block;
/*** icon - partial ***/
// * use !important to prevent issues with browser extensions that change fonts
font-family: var(--icon-font-family) !important;
font-style: normal;
font-variant: normal;

font-weight: normal; // CSS variables fallback
font-weight: var(--icon-font-weight, normal);
line-height: 1;
text-transform: none;
vertical-align: middle;
font-weight: normal; // CSS variables fallback
font-weight: var(--icon-font-weight, normal);
line-height: 1;
text-transform: none;
vertical-align: middle;

/* stylelint-disable */
// * Better Font Rendering ===========
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* stylelint-enable */
/* stylelint-disable */
// * Better Font Rendering ===========
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* stylelint-enable */

// Hiding icon from screenreaders
/* stylelint-disable */
-webkit-alt: "";
/* stylelint-enable */
alt: "";
speak: none; // Hiding icon from screenreaders, fallback by older notation
speak: never; // Hiding icon from screenreaders
// Hiding icon from screenreaders
/* stylelint-disable */
-webkit-alt: "";
/* stylelint-enable */
alt: "";
speak: none; // Hiding icon from screenreaders, fallback by older notation
speak: never; // Hiding icon from screenreaders
}
@media aural {
content: none;
}
Expand All @@ -77,7 +81,9 @@

// SCSS mixin for elements that text should get hidden in favour of only displaying the included icon
@mixin is-icon-text-replace($position: "before") {
font-size: 0;
& {
font-size: 0;
}

@if $position == "before" {
&::before {
Expand Down
8 changes: 5 additions & 3 deletions source/_patterns/01-elements/checkbox/checkbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
#{to-rem($pxValue: 24)}
);

@extend %form-element-enhanced-clickable-area;

@include icon("\00A0", 24, "outline", $partial: $partial);
align-content: center;

appearance: none;
Expand All @@ -26,6 +23,11 @@
justify-content: center;
width: var(--db-form-element-dimensions);

& {
@extend %form-element-enhanced-clickable-area;
@include icon("\00A0", 24, "outline", $partial: $partial);
}

&[type="checkbox"] {
vertical-align: top;
}
Expand Down
11 changes: 6 additions & 5 deletions source/_patterns/01-elements/select/select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@

// Style the regular (non-multiple) select elements
&:not([multiple]) {
// Semitransparent is the default style
@at-root :where(#{&}) {
@extend %form-element-semitransparent;
}

background-image: var(
--db-ic-expand-more-20,
url(#{$icons-path}functional/images/navigation/db_ic_expand_more_20.svg)
Expand All @@ -28,6 +23,12 @@
background-repeat: no-repeat;
height: to-rem($pxValue: 44);
padding: to-rem($pxValue: 20) to-rem($pxValue: 42) 0 $db-spacing-m;

// Semitransparent is the default style
@at-root :where(#{&}) {
@extend %form-element-semitransparent;
}

// No need to reposition the included value on hidden label
&:has(+ label[data-label-hidden="true"]) {
padding-top: 0;
Expand Down
10 changes: 5 additions & 5 deletions source/_patterns/01-elements/textarea/textarea.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
.elm-textarea {
@extend %form-element;

// Semitransparent is the default style
@at-root :where(#{&}) {
@extend %form-element-semitransparent;
}

display: block;

font-size: to-rem($pxValue: 16);
Expand All @@ -25,6 +20,11 @@

width: 100%;

// Semitransparent is the default style
@at-root :where(#{&}) {
@extend %form-element-semitransparent;
}

// * to be evaluated
// display: inline-flex;
// align-items: center;
Expand Down
17 changes: 10 additions & 7 deletions source/_patterns/02-components/accordion/accordion.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@
padding-right: $accordion---paddingRight;

summary {
@include icon(
glyph(expand-more),
24,
"outline",
"after",
$partial: $partial
);
align-items: center;
display: flex;
justify-content: space-between;
Expand All @@ -26,6 +19,16 @@
100% + var(--db-accordion---paddingLeft) + #{$accordion---paddingRight}
);

& {
@include icon(
glyph(expand-more),
24,
"outline",
"after",
$partial: $partial
);
}

// Replace existing marker with an icon from the library
&::-webkit-details-marker {
display: none;
Expand Down
13 changes: 10 additions & 3 deletions source/_patterns/02-components/dialog/dialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,19 @@

.elm-link {
&.is-close {
@include icon(glyph(close), 24, "outline", $partial: $partial);
@include is-icon-text-replace();

position: absolute;
right: 0;
top: 0;

& {
@include icon(
glyph(close),
24,
"outline",
$partial: $partial
);
@include is-icon-text-replace();
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,18 @@

.elm-link,
.elm-button {
@include icon(
glyph(expand-more),
24,
"outline",
"after",
$partial: $partial
);

padding-bottom: to-rem($pxValue: 22);

& {
@include icon(
glyph(expand-more),
24,
"outline",
"after",
$partial: $partial
);
}

&:hover {
color: $db-color-red-500;
}
Expand Down
6 changes: 4 additions & 2 deletions source/_patterns/02-components/link-list/link-list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@

li {
.elm-link {
@include icon(glyph(chevron-right), $partial: $partial);

font-weight: 700;
text-decoration: none;

& {
@include icon(glyph(chevron-right), $partial: $partial);
}

&:hover,
&:active {
text-decoration: underline;
Expand Down
14 changes: 11 additions & 3 deletions source/_patterns/02-components/mainnavigation/mainnavigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,24 @@
}

& > label[for] {
@include icon(glyph(menu), 24, "outline", $partial: $partial);
@include icon(glyph(close), 24, "outline", "after", $partial: $partial);

background-color: $header---backgroundColor; // TODO: This would need to get replaced by the correct (semantic) color

border-bottom: 1px solid $db-color-warm-gray-100;

display: block;
padding: to-rem($pxValue: 8) to-rem($pxValue: 22) to-rem($pxValue: 10);

& {
@include icon(glyph(menu), 24, "outline", $partial: $partial);
@include icon(
glyph(close),
24,
"outline",
"after",
$partial: $partial
);
}

&::before {
margin-right: to-rem($pxValue: 16);
}
Expand Down
16 changes: 9 additions & 7 deletions source/_patterns/02-components/overflow-menu/overflow-menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@
}

summary {
@include icon(
$cmp-overflow-menu-icon,
20,
"outline",
$partial: $partial
);

display: inline-block;

& {
@include icon(
$cmp-overflow-menu-icon,
20,
"outline",
$partial: $partial
);
}

&::before {
display: inline-block;
padding: to-rem($pxValue: 9) to-rem($pxValue: 12);
Expand Down
12 changes: 8 additions & 4 deletions source/_patterns/02-components/sitesearch/sitesearch.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@
}

.elm-label {
@include icon(glyph(search), 24, "outline", $partial: $partial);

display: inline-block;

& {
@include icon(glyph(search), 24, "outline", $partial: $partial);
}

&::before {
// TODO: Evaluate on whether this declaration could get moved to the general icon declarations
font-size: to-rem($pxValue: 22);
Expand All @@ -51,14 +53,16 @@
}

.elm-button {
@include icon(glyph(search), 24, "outline", $partial: $partial);

display: none;
left: 0;
position: absolute;
top: to-em($pxValue: 8);
visibility: hidden;

& {
@include icon(glyph(search), 24, "outline", $partial: $partial);
}

&::before {
left: to-rem($pxValue: 4);
margin: -9px;
Expand Down
10 changes: 4 additions & 6 deletions source/_patterns/03-areas/00-header/meta.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,14 @@

& > .elm-link {
&[rel="account"] {
@include is-icon-text-replace();

margin-left: to-rem($pxValue: 4);

@media screen and (min-width: #{($header-srOnly-linkAccount-breakpoint + 1)}rem) {
margin-left: to-rem($pxValue: 8);
& {
@include is-icon-text-replace();
}

@media screen and (max-width: #{($header-srOnly-linkAccount-breakpoint)}rem) {
@include is-icon-text-replace();
@media screen and (min-width: #{($header-srOnly-linkAccount-breakpoint + 1)}rem) {
margin-left: to-rem($pxValue: 8);
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions source/_patterns/03-areas/03-footer/footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@
@import "footer.variables";

.rea-footer {
@include clearfix($partial: $partial);

background-color: $footer---backgroundColor;
box-shadow: $footer---boxShadow;

color: $db-color-cool-gray-500;
margin-top: $footer---marginTop;
padding: #{to-rem($pxValue: 21)} #{to-rem($pxValue: 16)};

& {
@include clearfix($partial: $partial);
}

&.has-border {
border-top: $footer---borderTop;
}
Expand Down

0 comments on commit 530d829

Please sign in to comment.