Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📝 Typography documentation #2247

Merged
merged 11 commits into from
Aug 19, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,16 @@ export const Introduction: Story<LinearProgressProps> = (args) => {
const progress = useMockProgress(variant === 'indeterminate' ? null : value)

return (
<>
<Progress.Linear
value={progress}
{...args}
aria-label="Progress bar label"
/>
</>
<Progress.Linear
value={progress}
{...args}
aria-label="Progress bar label"
/>
)
}

export const Indeterminate: Story<LinearProgressProps> = () => (
<>
<Progress.Linear aria-label="Progress bar label" />
</>
<Progress.Linear aria-label="Progress bar label" />
)

export const Determinate: Story<LinearProgressProps> = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,22 +141,18 @@ export const RangeSliderWithDates: Story<SliderProps> = () => {
return new Date(iso).getTime()
}
return (
<>
<Slider
min={getUnixTime('2020-01-01')}
max={getUnixTime('2020-01-31')}
step={60 * 60 * 24 * 1000}
value={[getUnixTime('2020-01-01'), getUnixTime('2020-01-31')]}
outputFunction={outputFunction}
aria-label="Range slider with dates"
/>
</>
<Slider
min={getUnixTime('2020-01-01')}
max={getUnixTime('2020-01-31')}
step={60 * 60 * 24 * 1000}
value={[getUnixTime('2020-01-01'), getUnixTime('2020-01-31')]}
outputFunction={outputFunction}
aria-label="Range slider with dates"
/>
)
}
RangeSliderWithDates.storyName = 'Range slider with dates'

export const Disabled: Story<SliderProps> = () => (
<>
<Slider value={50} disabled aria-label="Disabled Slider" />
</>
<Slider value={50} disabled aria-label="Disabled Slider" />
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import { Links, PropsTable, Story, Stack, TypographyGroups } from './../../../.storybook/components'
import { Typography } from '.'

# Typography

Presents hierarchy and organises information as clearly and efficiently as possible, <br />
therefore text sizes and styles were developed to balance content density and reading comfort.

<Links
figmaUrl="https://www.figma.com/file/0TbIXrrObWj80Cf7KucKYFL0/Design-Tokens?node-id=2%3A4"
documentationUrl="https://eds.equinor.com/0b0c666ab/p/721544-typography/b/32c137"
sourceUrl="https://github.com/equinor/design-system/blob/develop/packages/eds-core-react/src/components/Typography/Typography.tsx"
npmUrl="https://www.npmjs.com/package/@equinor/eds-core-react"
></Links>

<Story id="typography-typography--introduction" />
<PropsTable />

## Usage

**Typeface**

The `Equinor` typeface is not included in `EDS` by default. It is available from the EDS CDN.

<ul>
<li>All the fonts:</li>
</ul>

```tsx
<link rel="stylesheet" href="https://eds-static.equinor.com/font/equinor-font.css" />
```

<ul>
<li>Individual font:</li>
</ul>

```tsx
<link rel="stylesheet" href="https://eds-static.equinor.com/font/equinor-regular.css" />
```

The `Equinor` typeface is the primary typeface and is available in four weights:

<ul>
<li><code>light</code>,</li>
<li><code>regular</code>,</li>
<li><code>medium</code>,</li>
<li><code>bold</code>,</li>
<li>with accompanying <code>italics</code>.</li>
</ul>

Please do not use <code>light</code> in digital interfaces except in special cases where the font size is over <code>48px</code>.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps a note about how the equinor font is not included in eds by default and has to be added (and how)

Copy link
Contributor Author

@martalalik martalalik Aug 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

**Paragraph**

<ul>
<li>Paragraph length is the number of characters in a line of text, this includes spaces.</li>
<li>To ensure readability, line length should be 55-80 characters.</li>
</ul>

**Component**

```tsx
import { Typography } from '@equinor/eds-core-react'

<Typography>Sample text</Typography>
```

## Overview

Typography groups with included varints:

Example: `<Typography group="input" variant="label"></Typography>`. <br />
Variants under `heading` and `paragraph` don’t require the group parameter.

<Story id="typography-typography--groups-overview" />

## Examples

### Colors

<Story id="typography-typography--colors" />

### Token property

The `token` property allows manipulate the appearance of the typography. <br />
Properties:

```tsx
const myToken = {
textAlign,
textDecoration,
textTransform,
fontFamily,
fontSize,
fontStyle,
fontWeight,
fontFeature,
color,
lineHeight,
letterSpacing,
}
```

<Story id="typography-typography--token-property" />

### Lines

<Story id="typography-typography--lines" />

### Link
Link used in body of text.

<Story id="typography-typography--link" />
Loading