|
| 1 | +import { |
| 2 | + StyleSheet, |
| 3 | + View, |
| 4 | +} from "react-native" |
| 5 | + |
| 6 | +import type { |
| 7 | + Meta, |
| 8 | + StoryFn, |
| 9 | +} from "@storybook/react-native" |
| 10 | + |
| 11 | +import { |
| 12 | + Text, |
| 13 | + type TextProps, |
| 14 | +} from "@audira/carbon-react-native" |
| 15 | + |
| 16 | +import { |
| 17 | + Spacing, |
| 18 | +} from "@audira/carbon-react-native-elements" |
| 19 | + |
| 20 | +interface Props { |
| 21 | + children?: string, |
| 22 | +} |
| 23 | + |
| 24 | +export default { |
| 25 | + title: "Components/Text/All Types", |
| 26 | + args: { |
| 27 | + children: "The quick brown fox jumps over the lazy dog", |
| 28 | + }, |
| 29 | + argTypes: { |
| 30 | + children: { |
| 31 | + control: "text", |
| 32 | + }, |
| 33 | + }, |
| 34 | +} satisfies Meta<Props> |
| 35 | + |
| 36 | +export const AllTypes: StoryFn<Props> = args => { |
| 37 | + return ( |
| 38 | + <View |
| 39 | + style={ styleSheet.textsContainer } |
| 40 | + > |
| 41 | + <TextCompose type="body_01" { ...args }/> |
| 42 | + <TextCompose type="body_02" { ...args }/> |
| 43 | + <TextCompose type="body_compact_01" { ...args }/> |
| 44 | + <TextCompose type="body_compact_02" { ...args }/> |
| 45 | + <TextCompose type="code_01" { ...args }/> |
| 46 | + <TextCompose type="code_02" { ...args }/> |
| 47 | + <TextCompose type="heading_01" { ...args }/> |
| 48 | + <TextCompose type="heading_02" { ...args }/> |
| 49 | + <TextCompose type="heading_03" { ...args }/> |
| 50 | + <TextCompose type="heading_04" { ...args }/> |
| 51 | + <TextCompose type="heading_05" { ...args }/> |
| 52 | + <TextCompose type="heading_06" { ...args }/> |
| 53 | + <TextCompose type="heading_07" { ...args }/> |
| 54 | + <TextCompose type="heading_compact_01" { ...args }/> |
| 55 | + <TextCompose type="heading_compact_02" { ...args }/> |
| 56 | + <TextCompose type="helper_text_01" { ...args }/> |
| 57 | + <TextCompose type="helper_text_02" { ...args }/> |
| 58 | + <TextCompose type="label_01" { ...args }/> |
| 59 | + <TextCompose type="label_02" { ...args }/> |
| 60 | + <TextCompose type="legal_01" { ...args }/> |
| 61 | + <TextCompose type="legal_02" { ...args }/> |
| 62 | + </View> |
| 63 | + ) |
| 64 | +} |
| 65 | + |
| 66 | +const |
| 67 | + styleSheet = |
| 68 | + StyleSheet.create({ |
| 69 | + textsContainer: { |
| 70 | + rowGap: Spacing.spacing_05, |
| 71 | + }, |
| 72 | + }) |
| 73 | + |
| 74 | +function TextCompose({ |
| 75 | + children, |
| 76 | + type, |
| 77 | + ...props |
| 78 | +}: TextProps) { |
| 79 | + |
| 80 | + return ( |
| 81 | + <Text |
| 82 | + { ...props } |
| 83 | + type={ type } |
| 84 | + > |
| 85 | + { children } :: { `${type}` } |
| 86 | + </Text> |
| 87 | + ) |
| 88 | + |
| 89 | +} |
0 commit comments