Skip to content

Commit cb0147b

Browse files
committed
fix(design-system): media queries are not effected by font-size changes
1 parent 1622c2b commit cb0147b

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

.changeset/nasty-laws-agree.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@strapi/design-system': patch
3+
---
4+
5+
fix: use px for media queries as font-size won't affect media queries

packages/strapi-design-system/src/ThemeProvider/ThemeProvider.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ const GlobalStyle = createGlobalStyle`
9797
margin: 0;
9898
padding: 0;
9999
border: 0;
100-
font-size: 100%;
101-
font: inherit;
102100
vertical-align: baseline;
103101
}
104102
/* HTML5 display-role reset for older browsers */
@@ -151,10 +149,13 @@ const GlobalStyle = createGlobalStyle`
151149
outline: none;
152150
}
153151
154-
body,html{
155-
height: 100%;
152+
html {
156153
/* Sets 1rem === 10px */
157154
font-size: 62.5%;
155+
}
156+
157+
body,html{
158+
height: 100%;
158159
line-height: 1;
159160
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
160161
}
@@ -165,7 +166,6 @@ const GlobalStyle = createGlobalStyle`
165166
border: none;
166167
background: none;
167168
color: inherit;
168-
font-size: 100%;
169169
cursor: pointer;
170170
font: inherit;
171171
}

packages/strapi-design-system/src/themes/common-theme.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export const commonTheme: CommonTheme = {
2424
spaces: ['0px', '4px', '8px', '12px', '16px', '20px', '24px', '32px', '40px', '48px', '56px', '64px'],
2525
borderRadius: '4px',
2626
mediaQueries: {
27-
tablet: `@media (max-width: 110rem)`,
28-
mobile: `@media (max-width: 55rem)`,
27+
tablet: `@media (max-width: 1100px)`,
28+
mobile: `@media (max-width: 550px)`,
2929
},
3030
fontSizes: [`1.1rem`, `1.2rem`, `1.4rem`, '1.6rem', `1.8rem`, `3.2rem`],
3131
lineHeights: [1.14, 1.22, 1.25, 1.33, 1.43, 1.45, 1.5],

0 commit comments

Comments
 (0)