Skip to content

Commit 891cb68

Browse files
author
Maksym Kotielnikov
committed
docs
1 parent 6af1624 commit 891cb68

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

docs/styleguide/typography.md

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
## Typography
2+
3+
Library exports helper functions `getFontLineHeight`, `getFontSize`, `getFontWeight`, `getFontStyle` which allow to use standardized and optimised for different screen sizes font styles together with `styled-components`.
4+
5+
### Font weights:
6+
7+
```
8+
const { styled, getFontStyle } = require('precise-ui');
9+
10+
const fontWeights = ['light', 'regular', 'medium', 'bold'];
11+
12+
const StyledText = styled.p`
13+
${({ size, weight, lineHeight }) => getFontStyle({ size, weight, lineHeight })}
14+
`;
15+
16+
<div>
17+
{fontWeights.map((weight) => <StyledText key={weight} size='xxLarge' weight={weight}>Lorem ipsum dolor sit amet [{weight}]</StyledText>)}
18+
</div>;
19+
20+
```
21+
22+
23+
### Font sizes:
24+
25+
```
26+
const { styled, getFontStyle } = require('precise-ui');
27+
28+
const fontSizes = ['xSmall', 'small', 'medium', 'large', 'xLarge', 'xxLarge', 'xxxLarge'];
29+
30+
31+
const StyledText = styled.p`
32+
${({ size, weight, lineHeight }) => getFontStyle({ size, weight, lineHeight })}
33+
`;
34+
35+
<div>
36+
{fontSizes.map((size) => <StyledText key={size} size={size}>Lorem ipsum dolor sit amet [{size}]</StyledText>)}
37+
</div>;
38+
39+
```

styleguide.config.js

+4
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ module.exports = {
7676
name: 'Types',
7777
content: path.resolve(__dirname, 'docs/styleguide/types.md'),
7878
},
79+
{
80+
name: 'Typography',
81+
content: path.resolve(__dirname, 'docs/styleguide/typography.md'),
82+
},
7983
],
8084
},
8185
{

0 commit comments

Comments
 (0)