Skip to content

Commit

Permalink
style: fix padding (to be tested)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideMininni-Fincons committed Sep 6, 2024
1 parent 6efacae commit c64b13f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
7 changes: 5 additions & 2 deletions src/elements/header/common/header-action.scss
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@
text-decoration: none;
min-height: var(--sbb-header-action-min-height);
min-width: var(--sbb-header-action-min-width);
padding-inline: var(--sbb-header-action-padding-inline);
padding-inline: var(
--sbb-header-action-padding-inline-zero,
var(--sbb-header-action-padding-inline)
);
cursor: pointer;
user-select: none;
outline: none;
Expand Down Expand Up @@ -145,7 +148,7 @@
//
// Move it left by 12px in collapsed width.
--sbb-header-first-item-margin-inline-start: #{sbb.px-to-rem-build(-12)};
--sbb-header-action-padding-inline: 0;
--sbb-header-action-padding-inline-zero: 0;

.sbb-header-action__text {
@include sbb.screen-reader-only;
Expand Down
17 changes: 3 additions & 14 deletions src/elements/header/header/header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -107,21 +107,10 @@
margin-inline-start: var(--sbb-header-first-item-margin-inline-start);
}

:host([size='s']) {
::slotted(:is(sbb-header-button, sbb-header-link)) {
::slotted(:is(sbb-header-button, sbb-header-link)) {
:host([size='s']) & {
--sbb-header-action-min-height: var(--sbb-size-element-xs);
}

// The padding for header-action elements in size=s changes from `sbb-spacing-fixed-5x` to `sbb-spacing-fixed-4x`;
// however this is valid until the text is not hidden due to the `expandFrom` property, when the padding goes to 0.
// The following rule is applied in a complementary way to the rule in header-action.scss:L138
// using the $from keyword to apply the correct pad.
@each $breakpoint, $value in sbb.$mq-breakpoints {
@include sbb.mq($from: #{$breakpoint}) {
::slotted(:is(sbb-header-button, sbb-header-link)[expand-from='#{$breakpoint}']) {
--sbb-header-action-padding-inline: var(--sbb-spacing-fixed-4x);
}
}
--sbb-header-action-padding-inline: var(--sbb-spacing-fixed-4x);
}
}

Expand Down

0 comments on commit c64b13f

Please sign in to comment.