diff --git a/components/Button/Button.stories.tsx b/components/Button/Button.stories.tsx
index f6c08ef..adc17e3 100644
--- a/components/Button/Button.stories.tsx
+++ b/components/Button/Button.stories.tsx
@@ -134,6 +134,62 @@ export const Types: ButtonStory = args => (
>
);
+export const Sizes: ButtonStory = args => (
+ <>
+
+ Button Sizes
+
+
+
+
+
+
+
+
+
+ >
+);
+
export const ContainedButtons: ButtonStory = args => (
<>
@@ -180,7 +236,6 @@ export const ContainedButtons: ButtonStory = args => (
>
);
-// Outlined Buttons
export const OutlinedButtons: ButtonStory = args => (
<>
@@ -223,7 +278,6 @@ export const OutlinedButtons: ButtonStory = args => (
>
);
-// Text Buttons
export const TextButtons: ButtonStory = args => (
<>
@@ -275,7 +329,6 @@ export const TextButtons: ButtonStory = args => (
>
);
-// Icon Buttons
export const IconButtons: ButtonStory = args => (
<>
@@ -350,7 +403,6 @@ export const IconButtons: ButtonStory = args => (
>
);
-// Icon Only Buttons
export const IconOnlyButtons: ButtonStory = args => (
<>
@@ -372,60 +424,3 @@ export const IconOnlyButtons: ButtonStory = args => (
>
);
-
-// Button Sizes
-export const ButtonSizes: ButtonStory = args => (
- <>
-
- Button Sizes
-
-
-
-
-
-
-
-
-
- >
-);
diff --git a/components/Button/Button.tsx b/components/Button/Button.tsx
index 3cc2e79..191f60b 100644
--- a/components/Button/Button.tsx
+++ b/components/Button/Button.tsx
@@ -11,6 +11,7 @@ import type {
ButtonTypeTypes,
ButtonVariantTypes,
} from './types';
+import type { TextVariantTypes } from '../Text/types';
const BaseButton = styled(Pressable)`
${flexbox}
@@ -67,17 +68,19 @@ const Button = ({
disabled,
});
- const textVariants: string = {
+ const textVariants = {
large: 'subtitle02Medium',
medium: 'subtitle03Medium',
small: 'subtitle03Medium',
- }[size];
+ }[size] as TextVariantTypes;
- const typeColor = disabled
- ? theme.colors.contentPassive
- : isPressed && type !== 'text'
- ? theme.colors.white
- : buttonTypes[type].color;
+ const typeColor = (
+ disabled
+ ? theme.colors.contentPassive
+ : isPressed && type !== 'text'
+ ? theme.colors.white
+ : buttonTypes[type].color
+ ) as string;
const textStyle = type === 'text' && !disabled ? styles.underlineText : {};
@@ -96,7 +99,7 @@ const Button = ({
{...rest}>
{icon
? React.createElement(icon, {
- fill: typeColor as string,
+ fill: typeColor,
testID: 'button-icon',
})
: null}
diff --git a/components/Text/Text.stories.tsx b/components/Text/Text.stories.tsx
index f49ed0f..af9dbef 100644
--- a/components/Text/Text.stories.tsx
+++ b/components/Text/Text.stories.tsx
@@ -2,8 +2,9 @@ import React from 'react';
import { ComponentStory, ComponentMeta } from '@storybook/react-native';
import Text from '../Text/Text';
import theme from '../../src/theme';
+import { TextVariantTypes } from './types';
-const variantList = Object.keys(theme.textStyle);
+const variantList = Object.keys(theme.textStyle) as TextVariantTypes[];
const TextMeta: ComponentMeta = {
title: 'Text',
@@ -15,7 +16,7 @@ const TextMeta: ComponentMeta = {
},
},
args: {
- variant: variantList[0] as string,
+ variant: variantList[0] as TextVariantTypes,
},
};
diff --git a/components/Text/Text.tsx b/components/Text/Text.tsx
index 5434bbb..344991f 100644
--- a/components/Text/Text.tsx
+++ b/components/Text/Text.tsx
@@ -3,21 +3,22 @@ import { Text as T } from 'react-native';
import styled from 'styled-components/native';
import {
compose,
- color,
+ color as styledColor,
space,
typography,
position,
size,
fontWeight,
textStyle,
- variant,
+ variant as styledVariant,
fontSize,
} from 'styled-system';
import theme from '../../src/theme';
+import { TextVariantTypes } from './types';
const StyledText = styled(T)(
compose(
- color,
+ styledColor,
space,
typography,
position,
@@ -25,17 +26,28 @@ const StyledText = styled(T)(
fontSize,
fontWeight,
textStyle,
- variant({ variants: theme.textStyle }),
+ styledVariant({ variants: theme.textStyle }),
),
);
-function Text(props: any) {
- return {props.children};
+function Text({
+ variant = 'bodyText',
+ color = 'contentPrimary',
+ ...rest
+}: {
+ variant?: TextVariantTypes;
+ color?: string;
+ [key: string]: any;
+}) {
+ return (
+
+ {rest.children}
+
+ );
}
-Text.defaultProps = {
- variant: 'bodyText',
- color: 'contentPrimary',
-};
-
export default Text;
diff --git a/components/Text/types.ts b/components/Text/types.ts
new file mode 100644
index 0000000..9b17c66
--- /dev/null
+++ b/components/Text/types.ts
@@ -0,0 +1,28 @@
+export type TextVariantTypes =
+ | 'heading1'
+ | 'heading2'
+ | 'heading3'
+ | 'subtitle01Regular'
+ | 'subtitle01Medium'
+ | 'subtitle01Semibold'
+ | 'subtitle01Bold'
+ | 'subtitle02Regular'
+ | 'subtitle02Medium'
+ | 'subtitle02Semibold'
+ | 'subtitle02Bold'
+ | 'subtitle03Regular'
+ | 'subtitle03Medium'
+ | 'subtitle03Semibold'
+ | 'subtitle03Bold'
+ | 'subtitle04Regular'
+ | 'subtitle04Medium'
+ | 'subtitle04Semibold'
+ | 'subtitle04Bold'
+ | 'bodyText'
+ | 'bodyUnderline'
+ | 'bodyTextLink'
+ | 'bodyLongText'
+ | 'captionText'
+ | 'captionMedium'
+ | 'captionLongText'
+ | 'captionTextLink';