-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Typography): add global typography CSS styles (#388)
- Loading branch information
1 parent
7906374
commit 3ae3748
Showing
20 changed files
with
450 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
343 changes: 343 additions & 0 deletions
343
packages/bee-q/src/_storybook/foundation/typography.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,343 @@ | ||
import { Canvas, Meta, Source, Typeset } from '@storybook/blocks'; | ||
|
||
<Meta title="Foundation/Typography" /> | ||
|
||
export const typography = { | ||
type: { | ||
primary: '"Outfit", sans-serif', | ||
}, | ||
weight: { | ||
regular: '400', | ||
semibold: '500', | ||
bold: '700', | ||
}, | ||
size: { | ||
xs: 12, | ||
s: 14, | ||
m: 16, | ||
l: 20, | ||
xl: 24, | ||
xxl: 32, | ||
xxl2: 40, | ||
xxl3: 48, | ||
xxl4: 56, | ||
xxl5: 64, | ||
}, | ||
}; | ||
|
||
export const SampleText = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'; | ||
|
||
# Typography | ||
|
||
Typography is an essential part of any design system, and it's important to understand the different types of typography and how to use them effectively. | ||
|
||
BEEQ uses the Outfit font, a versatile and modern typeface that caters to a wide range of typographical needs. | ||
|
||
**Font:** [Outfit](https://fonts.google.com/specimen/Outfit) | ||
|
||
The Outfit font is carefully selected for its excellent legibility, adaptability, and aesthetic appeal, ensuring a cohesive and visually pleasing user experience. | ||
|
||
# Built-in typography classes | ||
|
||
- [Display](#display) | ||
- [H1](#h1) | ||
- [H2](#h2) | ||
- [H3](#h3) | ||
- [H4](#h4) | ||
- [H5](#h5) | ||
- [H6](#h6) | ||
- [Body](#body) | ||
- [Caption](#caption) | ||
- [Overline](#overline) | ||
|
||
## Display | ||
|
||
Display typography is used for headlines, titles, and other large text elements that are meant to grab the reader's attention. | ||
It is often used for special announcements, promotions, or other important messages that need to stand out from the rest of the content on the page. | ||
To use the display font, add the `display` class to the element (recommended to be a `<h1>` HTML element). | ||
|
||
<Source dark format="dedent" language="html" code={`<h1 class="display">${SampleText}</h1>`} /> | ||
|
||
<div class="rounded-xs border border-solid border-stroke-success bg-ui-success-light p-m"> | ||
**💡 NOTE:** | ||
|
||
In addition to the `.display` class, you can also add the `.semibold` or `.bold` classes to change the font weight of the text. | ||
The `.semibold` class is a lighter weight than the `.bold` class, but still provides a noticeable difference in weight. | ||
**It applies to all headings, not just the display heading.** | ||
|
||
</div> | ||
|
||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.xxl5)]} | ||
fontWeight={typography.weight.normal} | ||
sampleText={SampleText} | ||
/> | ||
|
||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.xxl5)]} | ||
fontWeight={typography.weight.semibold} | ||
sampleText={SampleText} | ||
/> | ||
|
||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.xxl5)]} | ||
fontWeight={typography.weight.bold} | ||
sampleText={SampleText} | ||
/> | ||
|
||
## H1 | ||
|
||
The H1 heading is typically used as the main heading of a page or section, and should be visually distinct from other headings on the page. | ||
It is usually the largest and most prominent heading on the page, and is often used to introduce the main topic or purpose of the page. | ||
|
||
To set a H1 heading, you can use the native `h1` HTML tag: | ||
|
||
<Source dark format="dedent" language="html" code={`<h1>${SampleText}</h1>`} /> | ||
or the `.h1` class: | ||
<Source dark format="dedent" language="html" code={`<p class="h1">${SampleText}</p>`} /> | ||
|
||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.xxl4)]} | ||
fontWeight={typography.weight.normal} | ||
sampleText={SampleText} | ||
/> | ||
|
||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.xxl4)]} | ||
fontWeight={typography.weight.semibold} | ||
sampleText={SampleText} | ||
/> | ||
|
||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.xxl4)]} | ||
fontWeight={typography.weight.bold} | ||
sampleText={SampleText} | ||
/> | ||
|
||
## H2 | ||
|
||
The H2 heading is often used to introduce a new topic or section, and can be used to break up long blocks of text into more manageable sections. | ||
It should be visually distinct from other headings on the page, and is usually the second largest and most prominent heading on the page. | ||
|
||
To set a H1 heading, you can use the native `h2` HTML tag: | ||
|
||
<Source dark format="dedent" language="html" code={`<h2>${SampleText}</h2>`} /> | ||
or the `.h2` class: | ||
<Source dark format="dedent" language="html" code={`<p class="h2">${SampleText}</p>`} /> | ||
|
||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.xxl3)]} | ||
fontWeight={typography.weight.normal} | ||
sampleText={SampleText} | ||
/> | ||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.xxl3)]} | ||
fontWeight={typography.weight.semibold} | ||
sampleText={SampleText} | ||
/> | ||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.xxl3)]} | ||
fontWeight={typography.weight.bold} | ||
sampleText={SampleText} | ||
/> | ||
|
||
## H3 | ||
|
||
The H3 heading is used to introduce subtopics or sections within a larger topic. | ||
It should be visually distinct from other headings on the page, and is usually smaller than the H2 heading. | ||
|
||
To set a H1 heading, you can use the native `h3` HTML tag: | ||
|
||
<Source dark format="dedent" language="html" code={`<h3>${SampleText}</h3>`} /> | ||
or the `.h3` class: | ||
<Source dark format="dedent" language="html" code={`<p class="h3">${SampleText}</p>`} /> | ||
|
||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.xxl2)]} | ||
fontWeight={typography.weight.normal} | ||
sampleText={SampleText} | ||
/> | ||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.xxl2)]} | ||
fontWeight={typography.weight.semibold} | ||
sampleText={SampleText} | ||
/> | ||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.xxl2)]} | ||
fontWeight={typography.weight.bold} | ||
sampleText={SampleText} | ||
/> | ||
|
||
## H4 | ||
|
||
The H4 heading is used to introduce subtopics or sections within a larger topic. | ||
It should be visually distinct from other headings on the page, and is usually smaller than the H3 heading. | ||
|
||
To set a H1 heading, you can use the native `h4` HTML tag: | ||
|
||
<Source dark format="dedent" language="html" code={`<h4>${SampleText}</h4>`} /> | ||
or the `.h4` class: | ||
<Source dark format="dedent" language="html" code={`<p class="h4">${SampleText}</p>`} /> | ||
|
||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.xxl)]} | ||
fontWeight={typography.weight.normal} | ||
sampleText={SampleText} | ||
/> | ||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.xxl)]} | ||
fontWeight={typography.weight.semibold} | ||
sampleText={SampleText} | ||
/> | ||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.xxl)]} | ||
fontWeight={typography.weight.bold} | ||
sampleText={SampleText} | ||
/> | ||
|
||
## H5 | ||
|
||
The H5 heading is used to introduce subtopics or sections within a larger topic. | ||
It should be visually distinct from other headings on the page, and is usually smaller than the H4 heading. | ||
|
||
To set a H1 heading, you can use the native `h5` HTML tag: | ||
|
||
<Source dark format="dedent" language="html" code={`<h5>${SampleText}</h5>`} /> | ||
or the `.h5` class: | ||
<Source dark format="dedent" language="html" code={`<p class="h5">${SampleText}</p>`} /> | ||
|
||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.xl)]} | ||
fontWeight={typography.weight.normal} | ||
sampleText={SampleText} | ||
/> | ||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.xl)]} | ||
fontWeight={typography.weight.semibold} | ||
sampleText={SampleText} | ||
/> | ||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.xl)]} | ||
fontWeight={typography.weight.bold} | ||
sampleText={SampleText} | ||
/> | ||
|
||
## H6 | ||
|
||
The H6 heading is used to introduce subtopics or sections within a larger topic. | ||
It should be visually distinct from other headings on the page, and is usually smaller than the H5 heading. | ||
|
||
To set a H1 heading, you can use the native `h6` HTML tag: | ||
|
||
<Source dark format="dedent" language="html" code={`<h6>${SampleText}</h6>`} /> | ||
or the `.h6` class: | ||
<Source dark format="dedent" language="html" code={`<p class="h6">${SampleText}</p>`} /> | ||
|
||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.l)]} | ||
fontWeight={typography.weight.normal} | ||
sampleText={SampleText} | ||
/> | ||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.l)]} | ||
fontWeight={typography.weight.normal} | ||
sampleText={SampleText} | ||
/> | ||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.l)]} | ||
fontWeight={typography.weight.normal} | ||
sampleText={SampleText} | ||
/> | ||
|
||
## Body | ||
|
||
The body text is used for the main content of a page, and should be visually distinct from other headings on the page. | ||
|
||
<div class="rounded-xs border border-solid border-stroke-warning bg-ui-warning-light p-m"> | ||
❗️ BEEQ set by default the body styles in the global CSS, so **you don't need to add any class to use it**. | ||
</div> | ||
|
||
<Source dark format="dedent" language="html" code={`<p>${SampleText}</p>`} /> | ||
|
||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.m)]} | ||
fontWeight={typography.weight.normal} | ||
sampleText={SampleText} | ||
/> | ||
|
||
## Caption | ||
|
||
The caption element is used to provide a short description or explanation about an image or other visual element. | ||
It is typically used in conjunction with the figure element, which contains the visual element being described. | ||
|
||
To set a caption, you can use the native `figcaption` HTML tag: | ||
|
||
<Source dark format="dedent" language="html" code={`<figcaption>${SampleText}</figcaption>`} /> | ||
or the `.caption` class: | ||
<Source dark format="dedent" language="html" code={`<p class="caption">${SampleText}</p>`} /> | ||
|
||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.s)]} | ||
fontWeight={typography.weight.normal} | ||
sampleText={SampleText} | ||
/> | ||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.s)]} | ||
fontWeight={typography.weight.semibold} | ||
sampleText={SampleText} | ||
/> | ||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.s)]} | ||
fontWeight={typography.weight.bold} | ||
sampleText={SampleText} | ||
/> | ||
|
||
## Overline | ||
|
||
To set a overline, you can use the `.overline` CSS class: | ||
|
||
<Source dark format="dedent" language="html" code={`<span class="overline">${SampleText}</span>`} /> | ||
|
||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.xs)]} | ||
fontWeight={typography.weight.normal} | ||
sampleText={SampleText} | ||
/> | ||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.xs)]} | ||
fontWeight={typography.weight.semibold} | ||
sampleText={SampleText} | ||
/> | ||
<Typeset | ||
fontFamily={typography.type.primary} | ||
fontSizes={[Number(typography.size.xs)]} | ||
fontWeight={typography.weight.bold} | ||
sampleText={SampleText} | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.