From 73308af061af5e17ac7d4a73fa027a2f303c70dd Mon Sep 17 00:00:00 2001 From: Kirill Rogovoy Date: Fri, 23 Jul 2021 11:02:26 +0300 Subject: Update graph data when Emacs node changes + minor improvements --- app_expo/components/text/text.presets.ts | 48 ----------------- app_expo/components/text/text.props.ts | 37 ------------- app_expo/components/text/text.story.tsx | 92 -------------------------------- app_expo/components/text/text.tsx | 28 ---------- 4 files changed, 205 deletions(-) delete mode 100644 app_expo/components/text/text.presets.ts delete mode 100644 app_expo/components/text/text.props.ts delete mode 100644 app_expo/components/text/text.story.tsx delete mode 100644 app_expo/components/text/text.tsx (limited to 'app_expo/components/text') diff --git a/app_expo/components/text/text.presets.ts b/app_expo/components/text/text.presets.ts deleted file mode 100644 index 4693417..0000000 --- a/app_expo/components/text/text.presets.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { TextStyle } from 'react-native' -import { color, typography } from '../../theme' - -/** - * All text will start off looking like this. - */ -const BASE: TextStyle = { - fontFamily: typography.primary, - color: color.text, - fontSize: 15, -} - -/** - * All the variations of text styling within the app. - * - * You want to customize these to whatever you need in your app. - */ -export const presets = { - /** - * The default text styles. - */ - default: BASE, - - /** - * A bold version of the default text. - */ - bold: { ...BASE, fontWeight: 'bold' } as TextStyle, - - /** - * Large headers. - */ - header: { ...BASE, fontSize: 24, fontWeight: 'bold' } as TextStyle, - - /** - * Field labels that appear on forms above the inputs. - */ - fieldLabel: { ...BASE, fontSize: 13, color: color.dim } as TextStyle, - - /** - * A smaller piece of secondard information. - */ - secondary: { ...BASE, fontSize: 9, color: color.dim } as TextStyle, -} - -/** - * A list of preset names. - */ -export type TextPresets = keyof typeof presets diff --git a/app_expo/components/text/text.props.ts b/app_expo/components/text/text.props.ts deleted file mode 100644 index 79ee12c..0000000 --- a/app_expo/components/text/text.props.ts +++ /dev/null @@ -1,37 +0,0 @@ -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 { - /** - * Children components. - */ - children?: React.ReactNode - - /** - * Text which is looked up via i18n. - */ - tx?: TxKeyPath - - /** - * Optional options to pass to i18n. Useful for interpolation - * as well as explicitly setting locale or translation fallbacks. - */ - txOptions?: i18n.TranslateOptions - - /** - * The text to display if not using `tx` or nested components. - */ - text?: string - - /** - * An optional style override useful for padding & margin. - */ - style?: StyleProp - - /** - * One of the different types of text presets. - */ - preset?: TextPresets -} diff --git a/app_expo/components/text/text.story.tsx b/app_expo/components/text/text.story.tsx deleted file mode 100644 index edfe24d..0000000 --- a/app_expo/components/text/text.story.tsx +++ /dev/null @@ -1,92 +0,0 @@ -/* 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' - -declare let module - -const VIEWSTYLE = { - flex: 1, - backgroundColor: color.storybookDarkBg, -} -const viewStyleArray: ViewStyle[] = [VIEWSTYLE, { backgroundColor: '#7fff00' }] - -storiesOf('Text', module) - .addDecorator((fn) => {fn()}) - .add('Style Presets', () => ( - - - - Hello! - - Check out{'\n'} - my{'\n'} - line height - - The quick brown fox jumped over the slow lazy dog. - $123,456,789.00 - - - - - Osnap! I'm puffy. - - - - - Behold! - - - - )) - .add('Passing Content', () => ( - - - - - - - - - - - - - - - Passing strings as children. - - - - - - {' '} - Hello bolded World. - - - - - )) - .add('Styling', () => ( - - - - - {' '} - Hello bolded World. - - - - - )) diff --git a/app_expo/components/text/text.tsx b/app_expo/components/text/text.tsx deleted file mode 100644 index d9ffc8c..0000000 --- a/app_expo/components/text/text.tsx +++ /dev/null @@ -1,28 +0,0 @@ -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. - * - * This component is a HOC over the built-in React Native one. - */ -export function Text(props: TextProps) { - // grab the props - const { preset = 'default', tx, txOptions, text, children, style: styleOverride, ...rest } = props - - // figure out which content to use - const i18nText = tx && translate(tx, txOptions) - const content = i18nText || text || children - - const style = presets[preset] || presets.default - const styles = [style, styleOverride] - - return ( - - {content} - - ) -} -- cgit v1.2.3