diff --git a/packages/exoflex/example/src/examples/TypographyExample.tsx b/packages/exoflex/example/src/examples/TypographyExample.tsx new file mode 100644 index 000000000..6e7be8d1a --- /dev/null +++ b/packages/exoflex/example/src/examples/TypographyExample.tsx @@ -0,0 +1,67 @@ +import React from 'react'; +import { ScrollView, StyleSheet } from 'react-native'; +import { Typography } from 'exoflex'; + +let { + Heading, + Subheading, + LargeTitle, + Title, + Subtitle, + Paragraph, + Label, + Caption, +} = Typography; + +function TypographyExample() { + return ( + + Heading + Subheading + LargeTitle + Title + Subtitle + Paragraph + + Caption + + Medium Heading + + + Medium Subheading + + + Medium LargeTitle + + + Medium Title + + + Medium Subtitle + + + Medium Paragraph + + + + Medium Caption + + + ); +} + +TypographyExample.title = 'Typography'; + +let styles = StyleSheet.create({ + root: { + padding: 16, + backgroundColor: '#eeeeee', + }, + spacing: { + margin: 4, + }, +}); + +export default TypographyExample; diff --git a/packages/exoflex/example/src/examples/index.tsx b/packages/exoflex/example/src/examples/index.tsx index e5803ba27..665e12a93 100644 --- a/packages/exoflex/example/src/examples/index.tsx +++ b/packages/exoflex/example/src/examples/index.tsx @@ -19,6 +19,7 @@ import RadioButtonGroupExample from './RadioButtonGroupExample'; import SwitchExample from './SwitchExample'; import TextInputExample from './TextInputExample'; import ToastExample from './ToastExample'; +import TypographyExample from './TypographyExample'; import Welcome from '../Welcome'; @@ -41,6 +42,7 @@ export let EXAMPLES = { switch: SwitchExample, textinput: TextInputExample, toast: ToastExample, + typography: TypographyExample, }; export let ROUTES = Object.entries(EXAMPLES).reduce( diff --git a/packages/exoflex/src/components/Card/CardTitle.tsx b/packages/exoflex/src/components/Card/CardTitle.tsx index 6ba5300bf..0b1239ff8 100644 --- a/packages/exoflex/src/components/Card/CardTitle.tsx +++ b/packages/exoflex/src/components/Card/CardTitle.tsx @@ -7,8 +7,7 @@ import { ViewStyle, } from 'react-native'; -import Label from '../Label'; -import Text from '../Text'; +import { Label, Paragraph } from '../Typography'; type Props = { title: string; @@ -29,7 +28,11 @@ function CardTitle({ return ( - {!!title && {title}} + {!!title && ( + + {title} + + )} {!!subtitle && ( )} @@ -40,16 +43,6 @@ function CardTitle({ CardTitle.displayName = 'Card.Title'; -type TitleProps = { - children: string; - style?: StyleProp; -}; - -// TODO: Discuss Typograhpy with designer -let Title = ({ ...otherProps }: TitleProps) => ( - -); - let styles = StyleSheet.create({ root: { flexDirection: 'row', @@ -57,7 +50,11 @@ let styles = StyleSheet.create({ justifyContent: 'space-between', padding: 12, }, - subtitle: { marginTop: 2 }, + subtitle: { + marginTop: 2, + // TODO: This color should use colors.text with 0.6 opacity. + color: '#757575', + }, }); export default CardTitle; diff --git a/packages/exoflex/src/components/Label.tsx b/packages/exoflex/src/components/Label.tsx deleted file mode 100644 index efcf3bdde..000000000 --- a/packages/exoflex/src/components/Label.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import React from 'react'; -import { StyleSheet } from 'react-native'; - -import Text, { Props as TextProps } from './Text'; - -type Props = TextProps; - -function Label({ style, ...otherProps }: Props) { - return ( - - ); -} - -Label.defaultProps = Text.defaultProps; - -let styles = StyleSheet.create({ - root: { - fontSize: 12, - }, -}); - -export default Label; diff --git a/packages/exoflex/src/components/TextInput/ErrorMessage.tsx b/packages/exoflex/src/components/TextInput/ErrorMessage.tsx index df993fc20..ab499b622 100644 --- a/packages/exoflex/src/components/TextInput/ErrorMessage.tsx +++ b/packages/exoflex/src/components/TextInput/ErrorMessage.tsx @@ -1,7 +1,7 @@ import React, { ComponentProps } from 'react'; import { StyleSheet } from 'react-native'; -import Label from '../Label'; +import { Label } from '../Typography'; type Props = ComponentProps