-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(exoflex): add Typography components (#182)
* feat: add Typography components * docs: add example for Typography * refactor: replace Label with Typography components * refactor: rename SecondaryBody to Label * refactor: rename Body to Paragraph
- Loading branch information
1 parent
f2b4567
commit fe115f8
Showing
17 changed files
with
304 additions
and
50 deletions.
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
packages/exoflex/example/src/examples/TypographyExample.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<ScrollView contentContainerStyle={styles.root}> | ||
<Heading style={styles.spacing}>Heading</Heading> | ||
<Subheading style={styles.spacing}>Subheading</Subheading> | ||
<LargeTitle style={styles.spacing}>LargeTitle</LargeTitle> | ||
<Title style={styles.spacing}>Title</Title> | ||
<Subtitle style={styles.spacing}>Subtitle</Subtitle> | ||
<Paragraph style={styles.spacing}>Paragraph</Paragraph> | ||
<Label style={styles.spacing}>Label</Label> | ||
<Caption style={styles.spacing}>Caption</Caption> | ||
<Heading style={styles.spacing} weight="medium"> | ||
Medium Heading | ||
</Heading> | ||
<Subheading style={styles.spacing} weight="medium"> | ||
Medium Subheading | ||
</Subheading> | ||
<LargeTitle style={styles.spacing} weight="medium"> | ||
Medium LargeTitle | ||
</LargeTitle> | ||
<Title style={styles.spacing} weight="medium"> | ||
Medium Title | ||
</Title> | ||
<Subtitle style={styles.spacing} weight="medium"> | ||
Medium Subtitle | ||
</Subtitle> | ||
<Paragraph style={styles.spacing} weight="medium"> | ||
Medium Paragraph | ||
</Paragraph> | ||
<Label style={styles.spacing} weight="medium"> | ||
Medium Label | ||
</Label> | ||
<Caption style={styles.spacing} weight="medium"> | ||
Medium Caption | ||
</Caption> | ||
</ScrollView> | ||
); | ||
} | ||
|
||
TypographyExample.title = 'Typography'; | ||
|
||
let styles = StyleSheet.create({ | ||
root: { | ||
padding: 16, | ||
backgroundColor: '#eeeeee', | ||
}, | ||
spacing: { | ||
margin: 4, | ||
}, | ||
}); | ||
|
||
export default TypographyExample; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
import { StyleSheet } from 'react-native'; | ||
|
||
import Text, { Props as TextProps } from '../Text'; | ||
|
||
type Props = TextProps; | ||
|
||
function Caption({ style, ...otherProps }: Props) { | ||
return <Text {...otherProps} style={[styles.root, style]} />; | ||
} | ||
|
||
Caption.defaultProps = Text.defaultProps; | ||
|
||
let styles = StyleSheet.create({ | ||
root: { | ||
fontSize: 10, | ||
}, | ||
}); | ||
|
||
export default Caption; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react'; | ||
import { StyleSheet } from 'react-native'; | ||
|
||
import Text, { Props as TextProps } from '../Text'; | ||
|
||
type Props = TextProps; | ||
|
||
function Heading({ style, ...otherProps }: Props) { | ||
return ( | ||
<Text | ||
accessibilityRole="header" | ||
aria-level="1" | ||
style={[styles.root, style]} | ||
{...otherProps} | ||
/> | ||
); | ||
} | ||
|
||
Heading.defaultProps = Text.defaultProps; | ||
|
||
let styles = StyleSheet.create({ | ||
root: { | ||
fontSize: 42, | ||
}, | ||
}); | ||
|
||
export default Heading; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
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 <Text {...otherProps} style={[styles.root, style]} />; | ||
} | ||
|
||
Label.defaultProps = Text.defaultProps; | ||
|
||
let styles = StyleSheet.create({ | ||
root: { | ||
fontSize: 12, | ||
}, | ||
}); | ||
|
||
export default Label; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react'; | ||
import { StyleSheet } from 'react-native'; | ||
|
||
import Text, { Props as TextProps } from '../Text'; | ||
|
||
type Props = TextProps; | ||
|
||
function LargeTitle({ style, ...otherProps }: Props) { | ||
return ( | ||
<Text | ||
accessibilityRole="header" | ||
aria-level="3" | ||
{...otherProps} | ||
style={[styles.root, style]} | ||
/> | ||
); | ||
} | ||
|
||
LargeTitle.defaultProps = Text.defaultProps; | ||
|
||
let styles = StyleSheet.create({ | ||
root: { | ||
fontSize: 28, | ||
}, | ||
}); | ||
|
||
export default LargeTitle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
import { StyleSheet } from 'react-native'; | ||
|
||
import Text, { Props as TextProps } from '../Text'; | ||
|
||
type Props = TextProps; | ||
|
||
function Paragraph({ style, ...otherProps }: Props) { | ||
return <Text {...otherProps} style={[styles.root, style]} />; | ||
} | ||
|
||
Paragraph.defaultProps = Text.defaultProps; | ||
|
||
let styles = StyleSheet.create({ | ||
root: { | ||
fontSize: 14, | ||
}, | ||
}); | ||
|
||
export default Paragraph; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react'; | ||
import { StyleSheet } from 'react-native'; | ||
|
||
import Text, { Props as TextProps } from '../Text'; | ||
|
||
type Props = TextProps; | ||
|
||
function Subheading({ style, ...otherProps }: Props) { | ||
return ( | ||
<Text | ||
accessibilityRole="header" | ||
aria-level="2" | ||
{...otherProps} | ||
style={[styles.root, style]} | ||
/> | ||
); | ||
} | ||
|
||
Subheading.defaultProps = Text.defaultProps; | ||
|
||
let styles = StyleSheet.create({ | ||
root: { | ||
fontSize: 36, | ||
}, | ||
}); | ||
|
||
export default Subheading; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react'; | ||
import { StyleSheet } from 'react-native'; | ||
|
||
import Text, { Props as TextProps } from '../Text'; | ||
|
||
type Props = TextProps; | ||
|
||
function Subtitle({ style, ...otherProps }: Props) { | ||
return ( | ||
<Text | ||
accessibilityRole="header" | ||
aria-level="5" | ||
{...otherProps} | ||
style={[styles.root, style]} | ||
/> | ||
); | ||
} | ||
|
||
Subtitle.defaultProps = Text.defaultProps; | ||
|
||
let styles = StyleSheet.create({ | ||
root: { | ||
fontSize: 16, | ||
}, | ||
}); | ||
|
||
export default Subtitle; |
Oops, something went wrong.