Skip to content

Commit

Permalink
📱 Scale text to device
Browse files Browse the repository at this point in the history
🔥 Remove unused labelSmall
  • Loading branch information
petterhh committed Dec 9, 2024
1 parent 6835688 commit f0e0f60
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 25 deletions.
1 change: 0 additions & 1 deletion src/components/navigation/header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { defaultLanguage } from "i18n/supportedLanguages";
import LanguageSwitcher from "src/components/languageSwitcher/LanguageSwitcher";
import CustomLink from "src/components/link/CustomLink";
import LinkButton from "src/components/linkButton/LinkButton";
import Text from "src/components/text/Text";
import useScrollDirection from "src/utils/hooks/useScrollDirection";
import { getHref } from "src/utils/link";
import { Announcement } from "studio/lib/interfaces/announcement";
Expand Down
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
3 changes: 0 additions & 3 deletions src/components/text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export type TextType =
| "h6"
| "desktopLink"
| "desktopLinkBig"
| "labelSmall"
| "labelRegular"
| "labelLarge"
| "quoteItalic"
Expand All @@ -31,7 +30,6 @@ const elementMap: { [key in TextType]: keyof JSX.IntrinsicElements } = {
h6: "h6",
desktopLink: "p",
desktopLinkBig: "p",
labelSmall: "span",
labelRegular: "span",
labelLarge: "span",
quoteItalic: "p",
Expand All @@ -54,7 +52,6 @@ const classMap: { [key in TextType]?: string } = {
h6: styles.h6,
desktopLink: styles.desktopLink,
desktopLinkBig: styles.desktopLinkBig,
labelSmall: styles.labelSmall,
labelRegular: styles.labelRegular,
labelLarge: styles.labelLarge,
quoteItalic: styles.quoteItalic,
Expand Down
94 changes: 82 additions & 12 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,14 +73,21 @@
line-height: 120%;
}

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

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

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

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

.desktopLinkBig {
Expand All @@ -65,20 +96,44 @@
font-weight: 300;
line-height: 120%;
text-decoration-line: underline;

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

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

.bodyXl {
font-size: 2.5rem;
font-weight: 300;
line-height: 120%;
letter-spacing: 0.025rem;

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

@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) {
line-height: 120%;
}
}

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

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

.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 +166,36 @@
line-height: 128.571%;
letter-spacing: 0.00875rem;

@media (max-width: 375px) {
@media (max-width: 425px) {
font-size: 0.75px;
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: 128.571%;
}
}

.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 f0e0f60

Please sign in to comment.