Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use rem for the font size unit #3067

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/swift-bears-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@adyen/adyen-web': minor
---

Use `rem` for the font size unit, and fixed some style issues due to the font scaling.
4 changes: 2 additions & 2 deletions 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 All @@ -18,4 +18,4 @@ button {
max-width: 600px;
padding: 24px;
margin: auto;
}
}
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
2 changes: 1 addition & 1 deletion packages/lib/src/components/PayPal/Paypal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
&--processing {
align-items: center;
display: flex;
font-size: 13px;
font-size: token(text-body-font-size);
justify-content: center;
padding: token(spacer-090) 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
height: token(spacer-110);
display: flex;
align-items: center;
font-size: 13px;
font-size: token(text-body-font-size);
font-weight: token(text-body-font-weight);
line-height: token(text-caption-line-height);
padding: token(spacer-060) token(spacer-070);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
padding: token(spacer-060);
display: flex;
align-items: center;
font-size: 13px;
font-size: token(text-body-font-size);
font-weight: token(text-body-font-weight);
line-height: token(text-caption-line-height);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

&-title {
font-weight: 700;
font-size: token(spacer-080);
font-size: token(text-title-m-font-size);
line-height: token(spacer-090);
padding: 0;
margin: 0 0 token(spacer-060);
}

&-text {
font-weight: token(text-body-font-weight);
font-size: 13px;
font-size: token(text-body-font-size);
line-height: token(text-caption-line-height);
margin-bottom: token(spacer-070);
}
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
.adyen-checkout-ctp__otp-resend-code--disabled,
.adyen-checkout-ctp__otp-resend-code--confirmation {
pointer-events: none;
font-size: 13px;
font-size: token(text-body-font-size);
font-weight: token(text-body-font-weight);
margin-left: auto;
color: token(color-label-tertiary);
Expand All @@ -28,7 +28,7 @@
}

.adyen-checkout-ctp__otp-resend-code-counter {
font-size: 13px;
font-size: token(text-body-font-size);
font-weight: token(text-body-font-weight);
margin-left: auto;
cursor: default;
Expand All @@ -43,4 +43,4 @@

.adyen-checkout-ctp__otp-field-wrapper {
position: relative;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
.adyen-checkout-ctp__section {
position: relative;
background-color: white;
box-shadow: 0 6px 12px rgb(0 17 44 / 8%), 0 2px 4px rgb(0 17 44 / 4%);
box-shadow:
0 6px 12px rgb(0 17 44 / 8%),
0 2px 4px rgb(0 17 44 / 4%);
border-radius: token(spacer-060);
padding: token(spacer-070);

Expand All @@ -28,15 +30,15 @@
align-items: center;

&-title {
font-size: 17px;
font-size: token(text-title-font-size);
font-weight: token(text-title-font-weight);
line-height: 22px;
padding: 0;
margin: 0;
width: auto;

@media screen and (max-width: 400px) {
font-size: 15px;
font-size: token(text-body-font-size);
}
}

Expand All @@ -46,7 +48,7 @@
}

.adyen-checkout-ctp__section-text {
font-size: 13px;
font-size: token(text-body-font-size);
font-weight: token(text-body-font-weight);
line-height: token(text-caption-line-height);
color: token(color-label-tertiary);
Expand All @@ -55,6 +57,6 @@

.adyen-checkout-ctp__separator {
color: token(color-label-primary);
font-size: 13px;
font-size: token(text-body-font-size);
font-weight: token(text-body-font-weight);
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ span.adyen-checkout__input {
[dir='rtl'] & {
margin-left: token(spacer-060);
}

> .adyen-checkout__icon {
display: block;
}
longyulongyu marked this conversation as resolved.
Show resolved Hide resolved
}

.adyen-checkout-input__inline-validation--valid {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
}

.adyen-checkout__voucher-result__code__label__text {
font-size: 13px;
font-size: token(text-body-font-size);
color: token(color-label-primary);
background: token(color-background-primary);
padding: 0 token(spacer-040);
Expand Down
15 changes: 15 additions & 0 deletions packages/lib/src/styles/overrides.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Override the Bento font sizes. Calculation is based on a root font-size of 16 pixel.
$text-overrides: (
// 12px
'text-caption-font-size': 0.75rem,
// 14px
'text-body-font-size': 0.875rem,
// 16px
'text-subtitle-font-size': 1rem,
// 16px
'text-title-font-size': 1rem,
// 24px
'text-title-l-font-size': 1.5rem,
// 20px
'text-title-m-font-size': 1.25rem
);
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
Loading