|
| 1 | +import { ArgsTable, Meta, Primary, Stories, Unstyled } from '@storybook/blocks'; |
| 2 | +import { ItemWrapper } from '../../../../docs/components/ItemWrapper'; |
| 3 | +import { StyledSystemLinks } from '../../../docs/StyledSystemLinks'; |
| 4 | +import { Headline } from '../Headline'; |
| 5 | +import * as HeadlineStories from './Headline.stories'; |
| 6 | + |
| 7 | +<Meta of={HeadlineStories} /> |
| 8 | + |
| 9 | +# Headline |
| 10 | + |
| 11 | +<Primary /> |
| 12 | + |
| 13 | +The Headline component will render an html `h1-6` tag. Please reference the |
| 14 | +[w3 recommendations for headings](https://www.w3.org/WAI/tutorials/page-structure/headings/) to ensure your headings |
| 15 | +provide an accessible experience for screen reader users. |
| 16 | + |
| 17 | +Prefer to use headlines starting from level one and not skip levels. Use combination of `as` and `size` property to keep |
| 18 | +the semantics while following the design. |
| 19 | + |
| 20 | +- Use different headlines and paragraphs to structure your content hierarchically |
| 21 | +- Avoid using headline lengths, breaking more than two times (three times on mobile) |
| 22 | +- Avoid using sizes outside the given range |
| 23 | +- Recommended width of headline is between 500px and 700px |
| 24 | + |
| 25 | +## Properties |
| 26 | + |
| 27 | +<ArgsTable of={Headline} /> |
| 28 | +<StyledSystemLinks component="Headline" supportedProps={['margin', 'textAlign']} /> |
| 29 | + |
| 30 | +## Default headlines |
| 31 | + |
| 32 | +<Unstyled> |
| 33 | + <ItemWrapper> |
| 34 | + <Headline as="h1">headline h1</Headline> |
| 35 | + <Headline as="h2">headline h2</Headline> |
| 36 | + <Headline as="h3">headline h3</Headline> |
| 37 | + <Headline as="h4">headline h4</Headline> |
| 38 | + <Headline as="h5">headline h5</Headline> |
| 39 | + <Headline as="h6">headline h6</Headline> |
| 40 | + </ItemWrapper> |
| 41 | + <ItemWrapper inverted> |
| 42 | + <Headline as="h1" inverted> |
| 43 | + headline h1 inverted |
| 44 | + </Headline> |
| 45 | + <Headline as="h2" inverted> |
| 46 | + headline h2 inverted |
| 47 | + </Headline> |
| 48 | + <Headline as="h3" inverted> |
| 49 | + headline h3 inverted |
| 50 | + </Headline> |
| 51 | + <Headline as="h4" inverted> |
| 52 | + headline h4 inverted |
| 53 | + </Headline> |
| 54 | + <Headline as="h5" inverted> |
| 55 | + headline h5 inverted |
| 56 | + </Headline> |
| 57 | + <Headline as="h6" inverted> |
| 58 | + headline h6 inverted |
| 59 | + </Headline> |
| 60 | + </ItemWrapper> |
| 61 | +</Unstyled> |
| 62 | + |
| 63 | +## Responsive size |
| 64 | + |
| 65 | +The `size` property supports [responsive values](https://styled-system.com/responsive-styles/). Pass an array or an object |
| 66 | +and the design system use corresponding values for different viewport sizes. |
| 67 | + |
| 68 | +For example, the following snippet uses `s` size for mobile and `xl` size bigger screens: |
| 69 | + |
| 70 | +```jsx |
| 71 | +<Headline as="h2" size={{ _: 's', medium: 'xl' }}> |
| 72 | + Small on mobile, big on bigger screens |
| 73 | +</Headline> |
| 74 | +``` |
| 75 | + |
| 76 | +<Stories includePrimary={false} /> |
0 commit comments