diff --git a/.changeset/long-geckos-clap.md b/.changeset/long-geckos-clap.md new file mode 100644 index 0000000000..b6553e284c --- /dev/null +++ b/.changeset/long-geckos-clap.md @@ -0,0 +1,8 @@ +--- +'@swisspost/design-system-styles': patch +--- + +- Reduced horizontal padding of tertiary buttons. +- Updated font-size progression according to button size. +- Changed transparent color to full-tone colors. +- Updated slightly the font and border color of secondary and tertiary buttons. diff --git a/packages/styles/src/components/button.scss b/packages/styles/src/components/button.scss index c65911365b..d6b0361bb0 100644 --- a/packages/styles/src/components/button.scss +++ b/packages/styles/src/components/button.scss @@ -33,7 +33,7 @@ border-radius: button.$btn-border-radius; background-color: transparent; box-shadow: none; - color: var(--post-contrast-color); + color: var(--post-gray-80); font-family: inherit; font-weight: button.$btn-font-weight; text-decoration: none !important; // For tags, !important for hover @@ -43,7 +43,7 @@ // Primary .btn-primary { border-color: transparent; - background-color: rgba(var(--post-contrast-color-rgb), 0.8); + background-color: var(--post-gray-80); color: var(--post-contrast-color-inverted); @include utilities.not-disabled-focus-hover() { @@ -53,9 +53,14 @@ @include color-mx.on-dark-background { background-color: var(--post-contrast-color); + color: var(--post-gray-10); // Apply same color as secondary/tertiary button on dark theme @include utilities.not-disabled-focus-hover() { - background-color: rgba(var(--post-contrast-color-rgb), 0.8); + background-color: var(--post-gray-80); + } + + &:disabled { + color: var(--post-gray-80); } } @@ -83,7 +88,7 @@ } &:disabled { - background-color: rgba(var(--post-contrast-color-rgb), 0.4); + background-color: var(--post-gray-40); } .pi { @@ -96,28 +101,18 @@ .btn-default, .btn-secondary { @extend %btn-default; - - // Invert icon on dark backgrounds - @include color-mx.on-dark-background() { - .pi { - filter: invert(1); - } - } + @extend %btn-transparent-background; } // Tertiary .btn-link, .btn-tertiary { + @extend %btn-transparent-background; border: 0; - padding-right: 0.375rem; - padding-left: 0.375rem; - - @include utilities.not-disabled-focus-hover() { - color: rgba(var(--post-contrast-color-rgb), 0.8); - } + padding-inline: spacing.$size-micro; &:disabled { - color: rgba(var(--post-contrast-color-rgb), 0.6); + color: var(--post-gray-60); } // Styles to improve accessibility in high contrast mode diff --git a/packages/styles/src/mixins/_button.scss b/packages/styles/src/mixins/_button.scss index 2c69a4fdfa..ee8dae85b0 100644 --- a/packages/styles/src/mixins/_button.scss +++ b/packages/styles/src/mixins/_button.scss @@ -20,10 +20,13 @@ @mixin button-size($size: md) { min-height: map.get(button.$btn-height-map, $size); - padding: 0 map.get(button.$btn-padding-x-map, $size); font-size: map.get(button.$btn-font-size-map, $size); gap: map.get(button.$btn-padding-x-map, $size) * 0.5; + &:where(:not(.btn-link, .btn-tertiary)) { + padding: 0 map.get(button.$btn-padding-x-map, $size); + } + > .pi { width: map.get(button.$btn-icon-size-map, $size); height: map.get(button.$btn-icon-size-map, $size); diff --git a/packages/styles/src/placeholders/_button.scss b/packages/styles/src/placeholders/_button.scss index ffbebff732..1b3a93c77a 100644 --- a/packages/styles/src/placeholders/_button.scss +++ b/packages/styles/src/placeholders/_button.scss @@ -3,23 +3,35 @@ @use './../variables/components/button'; %btn-default { - border: button.$btn-border-width solid rgba(var(--post-contrast-color-rgb), 0.2); + border: button.$btn-border-width solid var(--post-gray-60); @include utilities.not-disabled-focus-hover() { border-color: var(--post-contrast-color); - color: var(--post-contrast-color); // Override color } @include color-mx.on-dark-background() { border-color: var(--post-contrast-color); @include utilities.not-disabled-focus-hover() { - border-color: rgba(var(--post-contrast-color-rgb), 0.4); + border-color: var(--post-gray-40); } } &:disabled { - border-color: rgba(var(--post-contrast-color-rgb), 0.4); - color: rgba(var(--post-contrast-color-rgb), 0.6); + border-color: var(--post-gray-40); + color: var(--post-gray-60); + } +} + +%btn-transparent-background { + @include utilities.not-disabled-focus-hover() { + color: var(--post-contrast-color); + } + + // Invert icon on dark backgrounds + @include color-mx.on-dark-background() { + .pi { + filter: invert(1); + } } } diff --git a/packages/styles/src/variables/_type.scss b/packages/styles/src/variables/_type.scss index 8c7f103e89..69842b1254 100644 --- a/packages/styles/src/variables/_type.scss +++ b/packages/styles/src/variables/_type.scss @@ -29,6 +29,7 @@ $font-size-small-huge: sizing.px-to-rem(48px); $font-size-huge: sizing.px-to-rem(56px); // New +$font-size-12: sizing.px-to-rem(12px); $font-size-14: sizing.px-to-rem(14px); $font-size-16: sizing.px-to-rem(16px); $font-size-18: sizing.px-to-rem(18px); diff --git a/packages/styles/src/variables/components/_button.scss b/packages/styles/src/variables/components/_button.scss index a59065bc42..53bfc16950 100644 --- a/packages/styles/src/variables/components/_button.scss +++ b/packages/styles/src/variables/components/_button.scss @@ -43,7 +43,7 @@ $btn-padding-x-sm: spacing.$size-regular !default; $btn-animation-distance-sm: spacing.$size-mini !default; // Design System only $btn-height-sm: 2rem; -$btn-font-size-sm: type.$font-size-tiny !default; +$btn-font-size-sm: type.$font-size-12 !default; $btn-icon-size-sm: spacing.$size-regular !default; // rg @@ -52,7 +52,7 @@ $btn-padding-x-rg: spacing.$size-large !default; $btn-animation-distance-rg: 0.625rem !default; // Design System only $btn-height-rg: 2.5rem; -$btn-font-size-rg: type.$font-size-regular !default; +$btn-font-size-rg: type.$font-size-14 !default; $btn-icon-size-rg: 1.125rem !default; // md @@ -61,7 +61,7 @@ $btn-padding-x-md: spacing.$size-big !default; $btn-animation-distance-md: spacing.$size-small-regular !default; // Design System only $btn-height-md: 3rem; -$btn-font-size-md: type.$font-size-regular !default; +$btn-font-size-md: type.$font-size-16 !default; $btn-icon-size-md: spacing.$size-small-large !default; // lg @@ -70,7 +70,7 @@ $btn-padding-x-lg: spacing.$size-bigger-big !default; $btn-animation-distance-lg: spacing.$size-regular !default; // Design System only $btn-height-lg: 3.5rem; -$btn-font-size-lg: type.$font-size-bigger-regular !default; +$btn-font-size-lg: type.$font-size-18 !default; $btn-icon-size-lg: spacing.$size-large !default; // Available button sizes except the default, which is md