Skip to content

Commit

Permalink
fix(docs): adjust tokens table doc (#705)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielduete authored Feb 17, 2025
1 parent 8c4bea9 commit 9fa4ba8
Show file tree
Hide file tree
Showing 8 changed files with 231 additions and 118 deletions.
34 changes: 19 additions & 15 deletions packages/tokens/stories/2_Spacings.mdx
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
import { Meta } from '@storybook/blocks'
import Table from './components/Table.jsx'

<Meta title="Tokens/Spacings" />
<Meta title='Tokens/Spacings' />

# Spacings

All spacings are defined as `--spacing-*` CSS variables.

| Size | Variable |
| ---- | -------------------------- |
| 4px | `var(--spacing-xxsmall)` |
| 8px | `var(--spacing-xsmall)` |
| 12px | `var(--spacing-small)` |
| 16px | `var(--spacing-base)` |
| 20px | `var(--spacing-medium)` |
| 24px | `var(--spacing-large)` |
| 28px | `var(--spacing-xlarge)` |
| 32px | `var(--spacing-xxlarge)` |
| 40px | `var(--spacing-xxxlarge)` |
| 48px | `var(--spacing-xxxxlarge)` |
| 64px | `var(--spacing-giant)` |
| 80px | `var(--spacing-xgiant)` |
<Table
headers={['Size', 'Variable']}
rows={[
['4px', 'var(--spacing-xxsmall)'],
['8px', 'var(--spacing-xsmall)'],
['12px', 'var(--spacing-small)'],
['16px', 'var(--spacing-base)'],
['20px', 'var(--spacing-medium)'],
['24px', 'var(--spacing-large)'],
['28px', 'var(--spacing-xlarge)'],
['32px', 'var(--spacing-xxlarge)'],
['40px', 'var(--spacing-xxxlarge)'],
['48px', 'var(--spacing-xxxxlarge)'],
['64px', 'var(--spacing-giant)'],
['80px', 'var(--spacing-xgiant)'],
]}
/>
82 changes: 48 additions & 34 deletions packages/tokens/stories/3_Typography.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Meta, Typeset } from '@storybook/blocks'
import Table from './components/Table.jsx'

<Meta title="Tokens/Typography" />
<Meta title='Tokens/Typography' />

# Typography

Expand All @@ -26,7 +27,7 @@ All typography tokens available in the design system.
'46px',
'52px',
]}
sampleText="Atomium is the best!"
sampleText='Atomium is the best!'
/>

## Using
Expand All @@ -35,31 +36,40 @@ Tokens could be used as CSS Variables or CSS Classes.

### Variable values

| Variable | Font weight | font-size/line-height | Mobile | Letter Spacing |
| -------------------------- | ----------- | --------------------- | --------- | -------------- |
| `--title-giant` | 700 | 52px/68px | 30px/40px | 0.25% |
| `--title-display` | 700 | 46px/60px | 28px/36px | 0.25% |
| `--title-headline-xxlarge` | 700 | 42px/56px | 26px/36px | 0.25% |
| `--title-headline-xlarge` | 700 | 36px/48px | 25px/32px | 0.25% |
| `--title-headline-large` | 700 | 32px/40px | 24px/32px | 0.25% |
| `--title-headline-medium` | 700 | 28px/36px | 22px/28px | 0.15% |
| `--title-headline-small` | 700 | 26px/36px | 20px/28px | 0.15% |
| `--title-headline-xsmall` | 700 | 22px/28px | 19px/24px | 0.15% |
| `--text-subtitle-large` | 700 | 20px/28px | 18px/24px | 0.15% |
| `--text-subtitle-medium` | 700 | 18px/24px | 16px/20px | 0.1% |
| `--text-body-large` | 400 | 18px/28px | 18px/28px | 0.5% |
| `--text-body-medium` | 400 | 16px/24px | 16px/24px | 0.5% |
| `--text-body-small` | 400 | 14px/24px | 14px/24px | 0.25% |
| `--text-link-large` | 700 | 18px/28px | 18px/28px | 0.5% |
| `--text-link-medium` | 700 | 16px/24px | 16px/24px | 0.5% |
| `--text-link-small` | 700 | 14px/24px | 14px/24px | 0.25% |
| `--button-large` | 700 | 18px/28px | 18px/28px | 8% |
| `--button-medium` | 700 | 16px/24px | 16px/24px | 8% |
| `--button-small` | 700 | 14px/20px | 14px/20px | 8% |
| `--text-caption` | 400 | 12px/20px | 14px/24px | 0.4% |
| `--text-caption-focused` | 700 | 12px/20px | 14px/24px | 0.4% |
| `--text-overline` | 400 | 11px/20px | 13px/20px | 16% |
| `--text-badge` | 700 | 10px/16px | 12px/20px | 4% |
<Table
headers={[
'Variable',
'Font weight',
'font-size/line-height',
'Mobile',
'Letter Spacing',
]}
rows={[
['--title-giant', '700', '52px/68px', '30px/40px', '0.25%'],
['--title-display', '700', '46px/60px', '28px/36px', '0.25%'],
['--title-headline-xxlarge', '700', '42px/56px', '26px/36px', '0.25%'],
['--title-headline-xlarge', '700', '36px/48px', '25px/32px', '0.25%'],
['--title-headline-large', '700', '32px/40px', '24px/32px', '0.25%'],
['--title-headline-medium', '700', '28px/36px', '22px/28px', '0.15%'],
['--title-headline-small', '700', '26px/36px', '20px/28px', '0.15%'],
['--title-headline-xsmall', '700', '22px/28px', '19px/24px', '0.15%'],
['--text-subtitle-large', '700', '20px/28px', '18px/24px', '0.15%'],
['--text-subtitle-medium', '700', '18px/24px', '16px/20px', '0.1%'],
['--text-body-large', '400', '18px/28px', '18px/28px', '0.5%'],
['--text-body-medium', '400', '16px/24px', '16px/24px', '0.5%'],
['--text-body-small', '400', '14px/24px', '14px/24px', '0.25%'],
['--text-link-large', '700', '18px/28px', '18px/28px', '0.5%'],
['--text-link-medium', '700', '16px/24px', '16px/24px', '0.5%'],
['--text-link-small', '700', '14px/24px', '14px/24px', '0.25%'],
['--button-large', '700', '18px/28px', '18px/28px', '8%'],
['--button-medium', '700', '16px/24px', '16px/24px', '8%'],
['--button-small', '700', '14px/20px', '14px/20px', '8%'],
['--text-caption', '400', '12px/20px', '14px/24px', '0.4%'],
['--text-caption-focused', '700', '12px/20px', '14px/24px', '0.4%'],
['--text-overline', '400', '11px/20px', '13px/20px', '16%'],
['--text-badge', '700', '10px/16px', '12px/20px', '4%'],
]}
/>

#### !important

Expand All @@ -69,13 +79,17 @@ All the `letter-spacing` variable is the font + letter, example: `var(--title-gi

### Font family

| Variable | Value |
| -------------------- | --------------------- |
| `var(--font-family)` | 'Roboto', sans-serif' |
<Table
headers={['Variable', 'Value']}
rows={[['var(--font-family)', "'Roboto', sans-serif'"]]}
/>

### Font weight

| Variable | Value |
| ---------------------------- | ----- |
| `var(--font-weight-regular)` | 400 |
| `var(--font-weight-bold)` | 700 |
<Table
headers={['Variable', 'Value']}
rows={[
['var(--font-family)', "'Roboto', sans-serif'"],
['var(--font-weight-bold)', '700'],
]}
/>
50 changes: 29 additions & 21 deletions packages/tokens/stories/4_Screens.mdx
Original file line number Diff line number Diff line change
@@ -1,34 +1,42 @@
import { Meta } from '@storybook/blocks'
import Table from './components/Table.jsx'

<Meta title="Tokens/Screens" />
<Meta title='Tokens/Screens' />

# Screens

All breakpoints used in our projects.

| Range | Screens |
| -------------- | ----------- |
| 0 - 575px | Extra Small |
| 576px - 767px | Small |
| 768px - 991px | Medium |
| 992px - 1199px | Large |
| >= 1200px | Extra Large |
<Table
headers={['Range', 'Screens']}
rows={[
['0 - 575px ', 'Extra Small'],
['576px - 767px', 'Small'],
['768px - 991px', 'Medium'],
['992px - 1199px', 'Large'],
['>= 1200px', 'Extra Large'],
]}
/>

## Variables

| Size | Variable |
| ------ | ------------------- |
| 576px | `var(--screen-xs)` |
| 768px | `var(--screen-sm)` |
| 992px | `var(--screen-md)` |
| 1200px | `var(--screen-lg)` |
| 1440px | `var(--screen-xlg)` |
| 1920px | `var(--screen-fhd)` |
| 2048px | `var(--screen-2k)` |
| 3840px | `var(--screen-4k)` |
<Table
headers={['Size', 'Variable']}
rows={[
['576px', 'var(--screen-xs)'],
['768px', 'var(--screen-sm)'],
['992px', 'var(--screen-md)'],
['1200px', 'var(--screen-lg)'],
['1440px', 'var(--screen-xlg)'],
['1920px', 'var(--screen-fhd)'],
['2048px', 'var(--screen-2k)'],
['3840px', 'var(--screen-4k)'],
]}
/>

We also has a variable to define the max size of containers.

| Size | Variable |
| ------ | ----------------------------- |
| 1136px | `var(--screen-max-container)` |
<Table
headers={['Size', 'Variable']}
rows={[['1136px', 'var(--screen-max-container)']]}
/>
31 changes: 19 additions & 12 deletions packages/tokens/stories/5_Grid.mdx
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
import { Meta } from '@storybook/blocks'
import Table from './components/Table.jsx'

<Meta title="Tokens/Grid" />
<Meta title='Tokens/Grid' />

# Grid

The [default grid system](/docs/components-grid--docs) is based on a `16` column grid with a `16px` gutter.

## Tokens

| Variable | Value |
| --------------------- | --------------------- |
| `var(--grid-gap)` | `var(--spacing-base)` |
| `var(--grid-columns)` | `12` |
<Table
headers={['Variable', 'Value']}
rows={[
['var(--grid-gap)', 'var(--spacing-base)'],
['var(--grid-columns)', '12'],
]}
/>

## Grid Patterns

You could check our [screen sizes here](/docs/tokens-screen-sizes--docs).

| Breakpoint | Container | Columns | Gutter | External Margin |
| ----------- | ---------------- | ------- | ------ | --------------- |
| Extra Small | Fluid | 4 | 8px | 16px |
| Small | Fluid | 8 | 8px | 16px |
| Medium | Fluid | 8 | 24px | 16px |
| Large | Fluid | 16 | 32px | 16px |
| Extra Large | Fixed (`1136px`) | 16 | auto | 16px |
<Table
headers={['Breakpoint', 'Container', 'Columns', 'Gutter', 'External Margin']}
rows={[
['Extra Small', 'Fluid', '4', '8px', '16px'],
['Small', 'Fluid', '8', '8px', '16px'],
['Medium', 'Fluid', '8', '24px', '16px'],
['Large', 'Fluid', '16', '32px', '16px'],
['Extra Large', 'Fixed (1136px)', '16', 'auto', '16px'],
]}
/>
62 changes: 43 additions & 19 deletions packages/tokens/stories/6_Misc.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Meta } from '@storybook/blocks'
import { Box, BoxList } from './components/Box.jsx'
import Table from './components/Table.jsx'

<Meta title="Tokens/Misc" />
<Meta title='Tokens/Misc' />

# Miscellaneous

Expand All @@ -11,12 +12,31 @@ In our Design System, most components have rounded edges. Depending on the size

### Variants

| value | Variable | Description |
| ----- | ----------------------------- | ------------------------------------------------------------------------------------------------------------- |
| 4px | `var(--border-radius)` | Used in smaller components like tooltips, alerts, text fields. |
| 8px | `var(--border-radius-medium)` | Used in larger components like dialogs, cards and dropdown menu. |
| 12px | `var(--border-radius-large)` | Depending on the context, the this border radius can also be used on larger components like cards and images. |
| 50% | `var(--border-radius-full)` | The fully rounded edge is used for specific components like buttons, badges and avatars. |
<Table
headers={['Variable', 'Value', 'Description']}
rows={[
[
'var(--border-radius)',
'4px',
'Used in smaller components like tooltips, alerts, text fields.',
],
[
'var(--border-radius-medium)',
'8px',
'Used in larger components like dialogs, cards and dropdown menu.',
],
[
'var(--border-radius-large)',
'12px',
'Depending on the context, this border radius can also be used on larger components like cards and images.',
],
[
'var(--border-radius-full)',
'50%',
'The fully rounded edge is used for specific components like buttons, badges and avatars.',
],
]}
/>

### Usage

Expand All @@ -27,9 +47,9 @@ This token must be used **only** with `border-radius` CSS property.
<BoxList>
<Box borderRadius="var(--border-radius)" />

<Box borderRadius="var(--border-radius-medium)" />
<Box borderRadius='var(--border-radius-medium)' />

<Box borderRadius="var(--border-radius-large)" />
<Box borderRadius='var(--border-radius-large)' />

<Box borderRadius="var(--border-radius-full)" />
</BoxList>
Expand All @@ -38,18 +58,22 @@ This token must be used **only** with `border-radius` CSS property.

The default `transition-duration` for all transitions

| value | Variable |
| ----- | ---------------------------- |
| 0.25s | `var(--transition-duration)` |
<Table
headers={['Variable', 'Value']}
rows={[['var(--transition-duration)', '0.25s']]}
/>

## z-index

All `z-index` variables to keep consistency

| value | Variable |
| ----- | ----------------------- |
| 1 | `var(--zindex-1)` |
| 10 | `var(--zindex-10)` |
| 100 | `var(--zindex-100)` |
| 1000 | `var(--zindex-1000)` |
| 10000 | `var(--zindex-overlay)` |
<Table
headers={['Variable', 'Value']}
rows={[
[1, 'var(--zindex-1)'],
[10, 'var(--zindex-100)'],
[100, 'var(--zindex-100)'],
[1000, 'var(--zindex-1000)'],
[10000, 'var(--zindex-overlay)'],
]}
/>
Loading

0 comments on commit 9fa4ba8

Please sign in to comment.