Skip to content

Commit

Permalink
Switch to font-display: optional (#2114)
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-baer authored May 21, 2023
1 parent da1a11b commit f53e433
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/tidy-knives-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sumup/circuit-ui': major
---

Changed the font-display of Aktiv Grotesk, Circuit UI's default font family, from `swap` to `optional`. If the font family is not available locally or cached, a fallback font is used. This reduces the cumulative layout shift (CLS) and largest contentful paint (LCP). The visual difference is minimal.
4 changes: 2 additions & 2 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@font-face {
font-family: 'aktiv-grotesk';
font-weight: 400;
font-display: swap;
font-display: optional;
src: url('https://static.sumup.com/fonts/latin-greek-cyrillic/aktiv-grotest-400.woff2')
format('woff2'),
url('https://static.sumup.com/fonts/latin-greek-cyrillic/aktiv-grotest-400.woff')
Expand All @@ -17,7 +17,7 @@
@font-face {
font-family: 'aktiv-grotesk';
font-weight: 700;
font-display: swap;
font-display: optional;
src: url('https://static.sumup.com/fonts/latin-greek-cyrillic/aktiv-grotest-700.woff2')
format('woff2'),
url('https://static.sumup.com/fonts/latin-greek-cyrillic/aktiv-grotest-700.woff')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ export const createBaseStyles = ({
@font-face {
font-family: 'aktiv-grotesk';
font-weight: 400;
font-display: swap;
font-display: optional;
src: url('${FONTS_BASE_URL}/aktiv-grotest-400.woff2') format('woff2'),
url('${FONTS_BASE_URL}/aktiv-grotest-400.woff') format('woff'),
url('${FONTS_BASE_URL}/aktiv-grotest-400.eot') format('embedded-opentype');
}
@font-face {
font-family: 'aktiv-grotesk';
font-weight: 700;
font-display: swap;
font-display: optional;
src: url('${FONTS_BASE_URL}/aktiv-grotest-700.woff2') format('woff2'),
url('${FONTS_BASE_URL}/aktiv-grotest-700.woff') format('woff'),
url('${FONTS_BASE_URL}/aktiv-grotest-700.eot') format('embedded-opentype');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ exports[`BaseStylesService > should return the global base styles 1`] = `
@font-face {
font-family: 'aktiv-grotesk';
font-weight: 400;
font-display: swap;
font-display: optional;
src: url('https://static.sumup.com/fonts/latin-greek-cyrillic/aktiv-grotest-400.woff2') format('woff2'),
url('https://static.sumup.com/fonts/latin-greek-cyrillic/aktiv-grotest-400.woff') format('woff'),
url('https://static.sumup.com/fonts/latin-greek-cyrillic/aktiv-grotest-400.eot') format('embedded-opentype');
}
@font-face {
font-family: 'aktiv-grotesk';
font-weight: 700;
font-display: swap;
font-display: optional;
src: url('https://static.sumup.com/fonts/latin-greek-cyrillic/aktiv-grotest-700.woff2') format('woff2'),
url('https://static.sumup.com/fonts/latin-greek-cyrillic/aktiv-grotest-700.woff') format('woff'),
url('https://static.sumup.com/fonts/latin-greek-cyrillic/aktiv-grotest-700.eot') format('embedded-opentype');
Expand Down

0 comments on commit f53e433

Please sign in to comment.