Skip to content

Commit

Permalink
style: use rem for font size unit
Browse files Browse the repository at this point in the history
  • Loading branch information
longyulongyu committed Jan 6, 2025
1 parent 0b5ebb7 commit 17a3aa9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/lib/.storybook/main.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
html,
body {
font:
16px/1.21 -apple-system,
1rem/1.21 -apple-system,
BlinkMacSystemFont,
sans-serif;
font-weight: 400;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
align-items: center;
display: flex;
flex-wrap: nowrap;
font-size: 1em;
font-size: token(text-title-font-size);
font-weight: token(text-body-font-weight);
justify-content: space-between;
position: relative;
Expand Down Expand Up @@ -47,7 +47,7 @@
}

.adyen-checkout__giftcard-result__remaining-balance {
font-size: 13px;
font-size: token(text-body-font-size);
line-height: token(text-caption-line-height);
text-align: center;
color: token(color-label-secondary);
Expand Down
8 changes: 8 additions & 0 deletions packages/lib/src/styles/overrides.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Override the Bento font sizes
$text-overrides: (
'text-caption-font-size': 0.75rem,
'text-body-font-size': 0.875rem,
'text-subtitle-font-size': 1rem,
'text-title-font-size': 1rem,
'text-title-l-font-size': 1.5rem
);
15 changes: 13 additions & 2 deletions packages/lib/src/styles/variable-generator.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@import '~@adyen/bento-design-tokens/dist/scss-map/bento/aliases';
@import '~@adyen/bento-design-tokens/dist/scss-map/bento/definitions';
@import '~@adyen/bento-design-tokens/dist/scss-map/bento/components';
@import 'overrides';

@function adyen-sdk-generate-css-variables($maps...) {
$adyen-output-map: ();
Expand All @@ -18,9 +19,19 @@
$adyen-tokens-map: ();

@if $generate-css-var {
$adyen-tokens-map: adyen-sdk-generate-css-variables($color, $text, $focus-ring, $border, $spacer, $shadow, $animation, $toggle);
$adyen-tokens-map: adyen-sdk-generate-css-variables(
$color,
$text,
$focus-ring,
$border,
$spacer,
$shadow,
$animation,
$toggle,
$text-overrides
);
} @else {
$adyen-tokens-map: map-merge($color, $text, $focus-ring, $border, $spacer, $shadow, $animation, $toggle);
$adyen-tokens-map: map-merge($color, $text, $focus-ring, $border, $spacer, $shadow, $animation, $toggle, $text-overrides);
}

@return map-get($adyen-tokens-map, '#{$token}');
Expand Down

0 comments on commit 17a3aa9

Please sign in to comment.