Skip to content

Commit b644cc6

Browse files
authored
fix: use rem for the font size unit (#3067)
* style: use `rem` for font size unit * refactor: some improvements and fix the validation icon position * refactor: use `text-title-m-font-size`
1 parent b0d3c21 commit b644cc6

File tree

14 files changed

+82
-33
lines changed

14 files changed

+82
-33
lines changed

.changeset/swift-bears-kiss.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@adyen/adyen-web': minor
3+
---
4+
5+
Use `rem` for the font size unit, and fixed some style issues due to the font scaling.

packages/lib/.storybook/main.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
html,
22
body {
33
font:
4-
16px/1.21 -apple-system,
4+
1rem/1.21 -apple-system,
55
BlinkMacSystemFont,
66
sans-serif;
77
font-weight: 400;
@@ -18,4 +18,4 @@ button {
1818
max-width: 600px;
1919
padding: 24px;
2020
margin: auto;
21-
}
21+
}

packages/lib/src/components/Giftcard/components/GiftcardResult.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
align-items: center;
55
display: flex;
66
flex-wrap: nowrap;
7-
font-size: 1em;
7+
font-size: token(text-title-font-size);
88
font-weight: token(text-body-font-weight);
99
justify-content: space-between;
1010
position: relative;
@@ -47,7 +47,7 @@
4747
}
4848

4949
.adyen-checkout__giftcard-result__remaining-balance {
50-
font-size: 13px;
50+
font-size: token(text-body-font-size);
5151
line-height: token(text-caption-line-height);
5252
text-align: center;
5353
color: token(color-label-secondary);

packages/lib/src/components/PayPal/Paypal.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
&--processing {
2424
align-items: center;
2525
display: flex;
26-
font-size: 13px;
26+
font-size: token(text-body-font-size);
2727
justify-content: center;
2828
padding: token(spacer-090) 0;
2929
}

packages/lib/src/components/internal/ClickToPay/components/CtPCards/CtPCards.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
height: token(spacer-110);
2020
display: flex;
2121
align-items: center;
22-
font-size: 13px;
22+
font-size: token(text-body-font-size);
2323
font-weight: token(text-body-font-weight);
2424
line-height: token(text-caption-line-height);
2525
padding: token(spacer-060) token(spacer-070);

packages/lib/src/components/internal/ClickToPay/components/CtPCards/CtPSingleCard/CtPSingleCard.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
padding: token(spacer-060);
88
display: flex;
99
align-items: center;
10-
font-size: 13px;
10+
font-size: token(text-body-font-size);
1111
font-weight: token(text-body-font-weight);
1212
line-height: token(text-caption-line-height);
1313

packages/lib/src/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88

99
&-title {
1010
font-weight: 700;
11-
font-size: token(spacer-080);
11+
font-size: token(text-title-m-font-size);
1212
line-height: token(spacer-090);
1313
padding: 0;
1414
margin: 0 0 token(spacer-060);
1515
}
1616

1717
&-text {
1818
font-weight: token(text-body-font-weight);
19-
font-size: 13px;
19+
font-size: token(text-body-font-size);
2020
line-height: token(text-caption-line-height);
2121
margin-bottom: token(spacer-070);
2222
}

packages/lib/src/components/internal/ClickToPay/components/CtPLoader/CtPLoader.scss

+25-13
Large diffs are not rendered by default.

packages/lib/src/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.scss

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
.adyen-checkout-ctp__otp-resend-code--disabled,
1212
.adyen-checkout-ctp__otp-resend-code--confirmation {
1313
pointer-events: none;
14-
font-size: 13px;
14+
font-size: token(text-body-font-size);
1515
font-weight: token(text-body-font-weight);
1616
margin-left: auto;
1717
color: token(color-label-tertiary);
@@ -28,7 +28,7 @@
2828
}
2929

3030
.adyen-checkout-ctp__otp-resend-code-counter {
31-
font-size: 13px;
31+
font-size: token(text-body-font-size);
3232
font-weight: token(text-body-font-weight);
3333
margin-left: auto;
3434
cursor: default;
@@ -43,4 +43,4 @@
4343

4444
.adyen-checkout-ctp__otp-field-wrapper {
4545
position: relative;
46-
}
46+
}

packages/lib/src/components/internal/ClickToPay/components/CtPSection/CtPSection.scss

+7-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
.adyen-checkout-ctp__section {
44
position: relative;
55
background-color: white;
6-
box-shadow: 0 6px 12px rgb(0 17 44 / 8%), 0 2px 4px rgb(0 17 44 / 4%);
6+
box-shadow:
7+
0 6px 12px rgb(0 17 44 / 8%),
8+
0 2px 4px rgb(0 17 44 / 4%);
79
border-radius: token(spacer-060);
810
padding: token(spacer-070);
911

@@ -28,15 +30,15 @@
2830
align-items: center;
2931

3032
&-title {
31-
font-size: 17px;
33+
font-size: token(text-title-font-size);
3234
font-weight: token(text-title-font-weight);
3335
line-height: 22px;
3436
padding: 0;
3537
margin: 0;
3638
width: auto;
3739

3840
@media screen and (max-width: 400px) {
39-
font-size: 15px;
41+
font-size: token(text-body-font-size);
4042
}
4143
}
4244

@@ -46,7 +48,7 @@
4648
}
4749

4850
.adyen-checkout-ctp__section-text {
49-
font-size: 13px;
51+
font-size: token(text-body-font-size);
5052
font-weight: token(text-body-font-weight);
5153
line-height: token(text-caption-line-height);
5254
color: token(color-label-tertiary);
@@ -55,6 +57,6 @@
5557

5658
.adyen-checkout-ctp__separator {
5759
color: token(color-label-primary);
58-
font-size: 13px;
60+
font-size: token(text-body-font-size);
5961
font-weight: token(text-body-font-weight);
6062
}

packages/lib/src/components/internal/FormFields/FormFields.scss

+4
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ span.adyen-checkout__input {
153153
[dir='rtl'] & {
154154
margin-left: token(spacer-060);
155155
}
156+
157+
> .adyen-checkout__icon {
158+
display: block;
159+
}
156160
}
157161

158162
.adyen-checkout-input__inline-validation--valid {

packages/lib/src/components/internal/Voucher/Voucher.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
}
121121

122122
.adyen-checkout__voucher-result__code__label__text {
123-
font-size: 13px;
123+
font-size: token(text-body-font-size);
124124
color: token(color-label-primary);
125125
background: token(color-background-primary);
126126
padding: 0 token(spacer-040);
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Override the Bento font sizes. Calculation is based on a root font-size of 16 pixel.
2+
$text-overrides: (
3+
// 12px
4+
'text-caption-font-size': 0.75rem,
5+
// 14px
6+
'text-body-font-size': 0.875rem,
7+
// 16px
8+
'text-subtitle-font-size': 1rem,
9+
// 16px
10+
'text-title-font-size': 1rem,
11+
// 24px
12+
'text-title-l-font-size': 1.5rem,
13+
// 20px
14+
'text-title-m-font-size': 1.25rem
15+
);

packages/lib/src/styles/variable-generator.scss

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@import '~@adyen/bento-design-tokens/dist/scss-map/bento/aliases';
22
@import '~@adyen/bento-design-tokens/dist/scss-map/bento/definitions';
33
@import '~@adyen/bento-design-tokens/dist/scss-map/bento/components';
4+
@import 'overrides';
45

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

2021
@if $generate-css-var {
21-
$adyen-tokens-map: adyen-sdk-generate-css-variables($color, $text, $focus-ring, $border, $spacer, $shadow, $animation, $toggle);
22+
$adyen-tokens-map: adyen-sdk-generate-css-variables(
23+
$color,
24+
$text,
25+
$focus-ring,
26+
$border,
27+
$spacer,
28+
$shadow,
29+
$animation,
30+
$toggle,
31+
$text-overrides
32+
);
2233
} @else {
23-
$adyen-tokens-map: map-merge($color, $text, $focus-ring, $border, $spacer, $shadow, $animation, $toggle);
34+
$adyen-tokens-map: map-merge($color, $text, $focus-ring, $border, $spacer, $shadow, $animation, $toggle, $text-overrides);
2435
}
2536

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

0 commit comments

Comments
 (0)