|
1 | 1 | /**
|
2 | 2 | * # RLText.js
|
3 |
| - * @providesModule RLText |
| 3 | + * Create some default text styles to re-use |
4 | 4 | * @flow
|
5 | 5 | */
|
6 | 6 |
|
7 |
| -import { Text as NativeText, StyleSheet } from 'react-native' |
8 |
| - |
9 |
| -import { normalise } from '../lib/StyleHelpers' |
10 |
| -import Colours from '../lib/RLColours' |
| 7 | +import { Text as RNText } from 'react-native-ui-lib' |
11 | 8 | import React from 'react'
|
12 |
| -import env from '../../../env' |
13 | 9 |
|
14 |
| -export function Text({ style, ...props }: Object) { |
15 |
| - return <NativeText style={[styles.font, style]} {...props} /> |
| 10 | +export function Text({ ...props }: Object) { |
| 11 | + return <RNText text70 {...props} /> |
16 | 12 | }
|
17 | 13 |
|
18 |
| -export function PageHeading({ style, ...props }: Object) { |
19 |
| - return <NativeText style={[styles.font, styles.page, style]} {...props} /> |
| 14 | +export function PageHeading({ ...props }: Object) { |
| 15 | + return <RNText marginV-21 text10 {...props} /> |
20 | 16 | }
|
21 | 17 |
|
22 |
| -export function Heading1({ style, ...props }: Object) { |
23 |
| - return <NativeText style={[styles.font, styles.h1, style]} {...props} /> |
| 18 | +export function Heading1({ ...props }: Object) { |
| 19 | + return <RNText text20 {...props} /> |
24 | 20 | }
|
25 | 21 |
|
26 |
| -export function Heading2({ style, ...props }: Object) { |
27 |
| - return <NativeText style={[styles.font, styles.h2, style]} {...props} /> |
| 22 | +export function Heading2({ ...props }: Object) { |
| 23 | + return <RNText text30 {...props} /> |
28 | 24 | }
|
29 | 25 |
|
30 |
| -export function Paragraph({ style, ...props }: Object) { |
31 |
| - return <NativeText style={[styles.font, styles.p, style]} {...props} /> |
| 26 | +export function Heading3({ ...props }: Object) { |
| 27 | + return <RNText text40 {...props} /> |
32 | 28 | }
|
33 | 29 |
|
34 |
| -export function ErrorText({ style, ...props }: Object) { |
35 |
| - return <NativeText style={[styles.font, styles.error, style]} {...props} /> |
| 30 | +export function Paragraph({ ...props }: Object) { |
| 31 | + return <Text marginB-18 {...props} /> |
36 | 32 | }
|
37 | 33 |
|
38 |
| -export function Small({ style, ...props }: Object) { |
39 |
| - return <NativeText style={[styles.font, styles.small, style]} {...props} /> |
| 34 | +export function ErrorText({ ...props }: Object) { |
| 35 | + return <RNText text80 {...props} /> |
40 | 36 | }
|
41 | 37 |
|
42 |
| -const styles = StyleSheet.create({ |
43 |
| - font: { |
44 |
| - fontFamily: env.fontFamily, |
45 |
| - }, |
46 |
| - page: { |
47 |
| - fontSize: normalise(28), |
48 |
| - lineHeight: normalise(34), |
49 |
| - color: Colours.darkText, |
50 |
| - fontWeight: 'bold', |
51 |
| - letterSpacing: -1, |
52 |
| - }, |
53 |
| - h1: { |
54 |
| - fontSize: normalise(24), |
55 |
| - lineHeight: normalise(27), |
56 |
| - color: Colours.darkText, |
57 |
| - fontWeight: 'bold', |
58 |
| - letterSpacing: -1, |
59 |
| - }, |
60 |
| - h2: { |
61 |
| - fontSize: normalise(20), |
62 |
| - lineHeight: normalise(27), |
63 |
| - color: Colours.darkText, |
64 |
| - fontWeight: 'bold', |
65 |
| - letterSpacing: -1.4, |
66 |
| - }, |
67 |
| - p: { |
68 |
| - fontSize: normalise(15), |
69 |
| - lineHeight: normalise(23), |
70 |
| - color: Colours.lightText, |
71 |
| - }, |
72 |
| - error: { |
73 |
| - fontSize: normalise(14), |
74 |
| - lineHeight: normalise(23), |
75 |
| - color: 'red', |
76 |
| - }, |
77 |
| - small: { |
78 |
| - fontSize: normalise(12), |
79 |
| - lineHeight: normalise(20), |
80 |
| - }, |
81 |
| -}) |
| 38 | +export function Small({ ...props }: Object) { |
| 39 | + return <RNText text90 {...props} /> |
| 40 | +} |
0 commit comments