Skip to content

Commit fca594c

Browse files
💄 Add line height property to body
Because utils method to convert lineheight token to lineheight style is here
1 parent 188b064 commit fca594c

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/components/typography/Body.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,33 @@ import { StyleProp, Text, TextStyle } from 'react-native';
33
import type { TextProps } from 'react-native-paper';
44
import { useTheme } from '../../styles/themes';
55
import { tokens } from '@zerogachis/smartway-design-token';
6-
import { getFont } from './utils';
6+
import { LineHeight } from '@zerogachis/smartway-design-token/dist/cjs/src/Tokens/TokensType';
7+
import { getFont, getLineHeight } from './utils';
78

89
type BodyTypography = keyof typeof tokens.typography.body;
910

1011
export interface BodyProps extends TextProps<Text> {
1112
typography?: BodyTypography;
13+
lineHeight?: keyof LineHeight;
1214
}
1315

14-
export const Body = ({ typography = 'n4', children, style, ...props }: BodyProps) => {
16+
export const Body = ({
17+
typography = 'n4',
18+
lineHeight = 'normal',
19+
children,
20+
style,
21+
...props
22+
}: BodyProps) => {
1523
const theme = useTheme();
1624

1725
const bodyStyle: StyleProp<TextStyle> = {
1826
color: theme.sw.color.neutral[800],
1927
fontSize: tokens.typography.body[typography]?.fontSize,
2028
fontFamily: getFont(tokens.typography.body[typography]),
29+
lineHeight: getLineHeight(
30+
tokens.lineHeight[lineHeight],
31+
tokens.typography.headline[typography]?.fontSize,
32+
),
2133
};
2234

2335
return (

0 commit comments

Comments
 (0)