From 7e5cfd5b505e0121746454bd98e82894c7cfda0c Mon Sep 17 00:00:00 2001 From: lukewalczak Date: Thu, 3 Mar 2022 17:45:53 +0100 Subject: [PATCH] refactor: correct prop description --- src/components/Typography/AnimatedText.tsx | 17 +++----- src/components/Typography/Text.tsx | 40 +++++++++---------- .../__tests__/Typography/Text.test.js | 30 +++++++------- 3 files changed, 41 insertions(+), 46 deletions(-) diff --git a/src/components/Typography/AnimatedText.tsx b/src/components/Typography/AnimatedText.tsx index a944258850..6c0a1f4171 100644 --- a/src/components/Typography/AnimatedText.tsx +++ b/src/components/Typography/AnimatedText.tsx @@ -14,15 +14,15 @@ type Props = React.ComponentPropsWithRef & { * Variant defines appropriate text styles for type role and its size. * Available variants: * - * Display: `display-large`, `display-small`, `display-small` + * Display: `displayLarge`, `displayMedium`, `displaySmall` * - * Headline: `headline-large`, `headline-medium`, `headline-small` + * Headline: `headlineLarge`, `headlineMedium`, `headlineSmall` * - * Title: `title-large`, `title-medium`, `title-small` + * Title: `titleLarge`, `titleMedium`, `titleSmall` * - * Label: `label-large`, `label-medium`, `label-small` + * Label: `labelLarge`, `labelMedium`, `labelSmall` * - * Body: `body-large`, `body-medium`, `body-small` + * Body: `bodyLarge`, `bodyMedium`, `bodySmall` */ variant?: keyof typeof MD3TypescaleKey; style?: StyleProp; @@ -37,12 +37,7 @@ type Props = React.ComponentPropsWithRef & { * * @extends Text props https://reactnative.dev/docs/text#props */ -function AnimatedText({ - style, - theme, - variant = 'labelLarge', - ...rest -}: Props) { +function AnimatedText({ style, theme, variant, ...rest }: Props) { const writingDirection = I18nManager.isRTL ? 'rtl' : 'ltr'; if (theme.isV3 && variant) { diff --git a/src/components/Typography/Text.tsx b/src/components/Typography/Text.tsx index 7361f3eba2..e113a0fc1e 100644 --- a/src/components/Typography/Text.tsx +++ b/src/components/Typography/Text.tsx @@ -16,15 +16,15 @@ type Props = React.ComponentProps & { * Variant defines appropriate text styles for type role and its size. * Available variants: * - * Display: `display-large`, `display-small`, `display-small` + * Display: `displayLarge`, `displayMedium`, `displaySmall` * - * Headline: `headline-large`, `headline-medium`, `headline-small` + * Headline: `headlineLarge`, `headlineMedium`, `headlineSmall` * - * Title: `title-large`, `title-medium`, `title-small` + * Title: `titleLarge`, `titleMedium`, `titleSmall` * - * Label: `label-large`, `label-medium`, `label-small` + * Label: `labelLarge`, `labelMedium`, `labelSmall` * - * Body: `body-large`, `body-medium`, `body-small` + * Body: `bodyLarge`, `bodyMedium`, `bodySmall` */ variant?: keyof typeof MD3TypescaleKey; children: React.ReactNode; @@ -45,25 +45,25 @@ type Props = React.ComponentProps & { * * const MyComponent = () => ( * <> - * Display Large - * Display Medium - * Display small + * Display Large + * Display Medium + * Display small * - * Headline Large - * Headline Medium - * Headline Small + * Headline Large + * Headline Medium + * Headline Small * - * Title Large - * Title Medium - * Title Small + * Title Large + * Title Medium + * Title Small * - * Body Large - * Body Medium - * Body Small + * Body Large + * Body Medium + * Body Small * - * Label Large - * Label Medium - * Label Small + * Label Large + * Label Medium + * Label Small * * ); * diff --git a/src/components/__tests__/Typography/Text.test.js b/src/components/__tests__/Typography/Text.test.js index ae55406ffd..346d6d1f08 100644 --- a/src/components/__tests__/Typography/Text.test.js +++ b/src/components/__tests__/Typography/Text.test.js @@ -7,25 +7,25 @@ it('renders every variant of Text with children as content', () => { const variants = ( <> - {content} - {content} - {content} + {content} + {content} + {content} - {content} - {content} - {content} + {content} + {content} + {content} - {content} - {content} - {content} + {content} + {content} + {content} - {content} - {content} - {content} + {content} + {content} + {content} - {content} - {content} - {content} + {content} + {content} + {content} );