summaryrefslogtreecommitdiff
path: root/app/components/text
diff options
context:
space:
mode:
Diffstat (limited to 'app/components/text')
-rw-r--r--app/components/text/text.presets.ts8
-rw-r--r--app/components/text/text.props.ts8
-rw-r--r--app/components/text/text.story.tsx39
-rw-r--r--app/components/text/text.tsx20
4 files changed, 44 insertions, 31 deletions
diff --git a/app/components/text/text.presets.ts b/app/components/text/text.presets.ts
index 9622268..4693417 100644
--- a/app/components/text/text.presets.ts
+++ b/app/components/text/text.presets.ts
@@ -1,5 +1,5 @@
-import { TextStyle } from "react-native"
-import { color, typography } from "../../theme"
+import { TextStyle } from 'react-native'
+import { color, typography } from '../../theme'
/**
* All text will start off looking like this.
@@ -24,12 +24,12 @@ export const presets = {
/**
* A bold version of the default text.
*/
- bold: { ...BASE, fontWeight: "bold" } as TextStyle,
+ bold: { ...BASE, fontWeight: 'bold' } as TextStyle,
/**
* Large headers.
*/
- header: { ...BASE, fontSize: 24, fontWeight: "bold" } as TextStyle,
+ header: { ...BASE, fontSize: 24, fontWeight: 'bold' } as TextStyle,
/**
* Field labels that appear on forms above the inputs.
diff --git a/app/components/text/text.props.ts b/app/components/text/text.props.ts
index d2c55dc..79ee12c 100644
--- a/app/components/text/text.props.ts
+++ b/app/components/text/text.props.ts
@@ -1,7 +1,7 @@
-import { StyleProp, TextProps as TextProperties, TextStyle } from "react-native"
-import i18n from "i18n-js"
-import { TextPresets } from "./text.presets"
-import { TxKeyPath } from "../../i18n"
+import { StyleProp, TextProps as TextProperties, TextStyle } from 'react-native'
+import i18n from 'i18n-js'
+import { TextPresets } from './text.presets'
+import { TxKeyPath } from '../../i18n'
export interface TextProps extends TextProperties {
/**
diff --git a/app/components/text/text.story.tsx b/app/components/text/text.story.tsx
index 5582c1b..4535194 100644
--- a/app/components/text/text.story.tsx
+++ b/app/components/text/text.story.tsx
@@ -1,12 +1,12 @@
/* eslint-disable react-native/no-inline-styles */
/* eslint-disable react-native/no-color-literals */
-import * as React from "react"
-import { View, ViewStyle } from "react-native"
-import { storiesOf } from "@storybook/react-native"
-import { StoryScreen, Story, UseCase } from "../../../storybook/views"
-import { color } from "../../theme"
-import { Text } from "./text"
+import * as React from 'react'
+import { View, ViewStyle } from 'react-native'
+import { storiesOf } from '@storybook/react-native'
+import { StoryScreen, Story, UseCase } from '../../../storybook/views'
+import { color } from '../../theme'
+import { Text } from './text'
declare let module
@@ -14,21 +14,23 @@ const VIEWSTYLE = {
flex: 1,
backgroundColor: color.storybookDarkBg,
}
-const viewStyleArray: ViewStyle[] = [VIEWSTYLE, { backgroundColor: "#7fff00" }]
+const viewStyleArray: ViewStyle[] = [VIEWSTYLE, { backgroundColor: '#7fff00' }]
-storiesOf("Text", module)
+storiesOf('Text', module)
.addDecorator((fn) => <StoryScreen>{fn()}</StoryScreen>)
- .add("Style Presets", () => (
+ .add('Style Presets', () => (
<Story>
<UseCase text="default" usage="Used for normal body text.">
<View style={VIEWSTYLE}>
<Text>Hello!</Text>
<Text style={{ paddingTop: 10 }}>
- Check out{"\n"}
- my{"\n"}
+ Check out{'\n'}
+ my{'\n'}
line height
</Text>
- <Text style={{ paddingTop: 10 }}>The quick brown fox jumped over the slow lazy dog.</Text>
+ <Text style={{ paddingTop: 10 }}>
+ The quick brown fox jumped over the slow lazy dog.
+ </Text>
<Text>$123,456,789.00</Text>
</View>
</UseCase>
@@ -44,7 +46,7 @@ storiesOf("Text", module)
</UseCase>
</Story>
))
- .add("Passing Content", () => (
+ .add('Passing Content', () => (
<Story>
<UseCase
text="text"
@@ -68,22 +70,25 @@ storiesOf("Text", module)
<Text>Passing strings as children.</Text>
</View>
</UseCase>
- <UseCase text="nested children" usage="You can embed them and change styles too.">
+ <UseCase
+ text="nested children"
+ usage="You can embed them and change styles too."
+ >
<View style={VIEWSTYLE}>
<Text>
- {" "}
+ {' '}
Hello <Text preset="bold">bolded</Text> World.
</Text>
</View>
</UseCase>
</Story>
))
- .add("Styling", () => (
+ .add('Styling', () => (
<Story>
<UseCase text="Style array" usage="Text with style array">
<View style={viewStyleArray}>
<Text>
- {" "}
+ {' '}
Hello <Text preset="bold">bolded</Text> World.
</Text>
</View>
diff --git a/app/components/text/text.tsx b/app/components/text/text.tsx
index 3ea613b..b04b654 100644
--- a/app/components/text/text.tsx
+++ b/app/components/text/text.tsx
@@ -1,8 +1,8 @@
-import * as React from "react"
-import { Text as ReactNativeText } from "react-native"
-import { presets } from "./text.presets"
-import { TextProps } from "./text.props"
-import { translate } from "../../i18n"
+import * as React from 'react'
+import { Text as ReactNativeText } from 'react-native'
+import { presets } from './text.presets'
+import { TextProps } from './text.props'
+import { translate } from '../../i18n'
/**
* For your text displaying needs.
@@ -11,7 +11,15 @@ import { translate } from "../../i18n"
*/
export function Text(props: TextProps) {
// grab the props
- const { preset = "default", tx, txOptions, text, children, style: styleOverride, ...rest } = props
+ const {
+ preset = 'default',
+ tx,
+ txOptions,
+ text,
+ children,
+ style: styleOverride,
+ ...rest
+ } = props
// figure out which content to use
const i18nText = tx && translate(tx, txOptions)