Skip to content

Commit

Permalink
πŸ“± Scale font sizes to device (#973)
Browse files Browse the repository at this point in the history
* πŸ“± Scale text to device
πŸ”₯ Remove unused labelSmall

* πŸ”₯ Remove unused desktopLinkBig

* Update src/components/text/text.module.css

Co-authored-by: Mikael Brevik <[email protected]>

* πŸ’„ Update more styles

---------

Co-authored-by: Mikael Brevik <[email protected]>
  • Loading branch information
petterhh and mikaelbr authored Dec 10, 2024
1 parent b639835 commit c3fa6c1
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 35 deletions.
2 changes: 1 addition & 1 deletion src/components/sections/article/Article.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const Article = ({ article }: ArticleProps) => {
)}
<div className={styles.content}>
<div>
<Text type="labelSmall">{article.tag}</Text>
<Text type="labelRegular">{article.tag}</Text>
<Text type="h2">{article.basicTitle}</Text>
</div>
{article.richText && <RichText value={article.richText} />}
Expand Down
8 changes: 0 additions & 8 deletions src/components/text/Text.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const meta: Meta<typeof Text> = {
"h4",
"h5",
"h6",
"labelSmall",
"labelRegular",
"quoteItalic",
"quoteNormal",
Expand Down Expand Up @@ -90,13 +89,6 @@ export const H6: Story = {
},
};

export const LabelSmall: Story = {
args: {
type: "labelSmall",
children: "This is a Label Small text",
},
};

export const LabelRegular: Story = {
args: {
type: "labelRegular",
Expand Down
6 changes: 0 additions & 6 deletions src/components/text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ export type TextType =
| "h5"
| "h6"
| "desktopLink"
| "desktopLinkBig"
| "labelSmall"
| "labelRegular"
| "labelLarge"
| "quoteItalic"
Expand All @@ -30,8 +28,6 @@ const elementMap: { [key in TextType]: keyof JSX.IntrinsicElements } = {
h5: "h5",
h6: "h6",
desktopLink: "p",
desktopLinkBig: "p",
labelSmall: "span",
labelRegular: "span",
labelLarge: "span",
quoteItalic: "p",
Expand All @@ -53,8 +49,6 @@ const classMap: { [key in TextType]?: string } = {
h5: styles.h5,
h6: styles.h6,
desktopLink: styles.desktopLink,
desktopLinkBig: styles.desktopLinkBig,
labelSmall: styles.labelSmall,
labelRegular: styles.labelRegular,
labelLarge: styles.labelLarge,
quoteItalic: styles.quoteItalic,
Expand Down
79 changes: 59 additions & 20 deletions src/components/text/text.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
font-family: var(--font-britti-sans);
}

.labelSmall,
.labelRegular,
.quoteItalic,
.quoteNormal,
Expand All @@ -21,18 +20,43 @@
font-style: normal;
font-weight: 450;
line-height: 111.111%;

@media (max-width: 834px) {
font-size: 3.5rem;
line-height: 114.286%;
}

@media (max-width: 425px) {
font-size: 2.5rem;
line-height: 120%;
}
}

.h2 {
font-size: 3.5rem;
font-weight: 450;
line-height: 114.286%;

@media (max-width: 834px) {
font-size: 2.5rem;
line-height: 120%;
}

@media (max-width: 425px) {
font-size: 2rem;
line-height: 125%;
}
}

.h3 {
font-size: 2rem;
font-weight: 450;
line-height: 125%;

@media (max-width: 425px) {
font-size: 1.5rem;
line-height: 133.333%;
}
}

.h4 {
Expand All @@ -49,21 +73,11 @@
line-height: 120%;
}

/* TODO: add font variables */
/* .h6 */

.desktopLink {
font-size: 1rem;
font-style: normal;
font-weight: 400;
line-height: 150%;
}

.desktopLinkBig {
font-size: 1.25rem;
font-style: normal;
font-weight: 300;
line-height: 120%;
text-decoration-line: underline;
}

Expand All @@ -72,13 +86,22 @@
font-weight: 300;
line-height: 120%;
letter-spacing: 0.025rem;

@media (max-width: 425px) {
font-size: 2rem;
line-height: 125%;
}
}

.bodyBig {
font-size: 1.5rem;
font-style: normal;
font-weight: 300;
line-height: 133.333%;

@media (max-width: 425px) {
font-size: 1.125rem;
}
}

.bodyNormal {
Expand All @@ -87,12 +110,22 @@
font-weight: 300;
line-height: 160%;
letter-spacing: 0.0125rem;

@media (max-width: 425px) {
font-size: 0.875rem;
line-height: 171.429%;
}
}

.bodySmall {
font-size: 1rem;
font-weight: 400;
font-weight: 300;
line-height: 150%;

@media (max-width: 425px) {
font-size: 0.875rem;
line-height: 114.286%;
}
}

.bodyExtraSmall {
Expand All @@ -101,31 +134,37 @@
line-height: 128.571%;
letter-spacing: 0.00875rem;

@media (max-width: 375px) {
font-size: 0.75px;
@media (max-width: 425px) {
font-size: 0.75rem;
line-height: 150%;
letter-spacing: 0.0075rem;
}
}

.labelSmall {
font-size: 0.875rem;
font-weight: 400;
line-height: 171.429%;
}

.labelRegular {
font-size: 1rem;
font-style: normal;
font-weight: 400;
line-height: 150%;
letter-spacing: 0.02rem;

@media (max-width: 425px) {
font-size: 0.875rem;
line-height: 114.286%;
letter-spacing: 0.0175rem;
}
}

.labelLarge {
font-size: 1.25rem;
font-style: normal;
font-weight: 400;
line-height: 120%;

@media (max-width: 425px) {
font-size: 1.125rem;
line-height: 133.333%;
}
}

.quoteNormal {
Expand Down

0 comments on commit c3fa6c1

Please sign in to comment.