From 6533d7dd084ad8cdd479a0d9b416f94c809d96e1 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Mon, 13 Mar 2023 20:34:01 -0500 Subject: Add /support and /support/privacy --- src/view/com/util/Html.tsx | 133 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 src/view/com/util/Html.tsx (limited to 'src/view/com/util/Html.tsx') diff --git a/src/view/com/util/Html.tsx b/src/view/com/util/Html.tsx new file mode 100644 index 000000000..245952e40 --- /dev/null +++ b/src/view/com/util/Html.tsx @@ -0,0 +1,133 @@ +import React from 'react' +import {StyleSheet, View} from 'react-native' +import {usePalette} from 'lib/hooks/usePalette' +import {Text} from './text/Text' +import {TextLink} from './Link' + +/** + * These utilities are used to define long documents in an html-like + * DSL. See for instance /locale/en/privacy-policy.tsx + */ + +export function H1({children}: React.PropsWithChildren<{}>) { + const pal = usePalette('default') + return ( + + {children} + + ) +} + +export function H2({children}: React.PropsWithChildren<{}>) { + const pal = usePalette('default') + return ( + + {children} + + ) +} + +export function H3({children}: React.PropsWithChildren<{}>) { + const pal = usePalette('default') + return ( + + {children} + + ) +} + +export function H4({children}: React.PropsWithChildren<{}>) { + const pal = usePalette('default') + return ( + + {children} + + ) +} + +export function P({children}: React.PropsWithChildren<{}>) { + const pal = usePalette('default') + return ( + + {children} + + ) +} + +export function UL({children}: React.PropsWithChildren<{}>) { + return {children} +} + +export function OL({children}: React.PropsWithChildren<{}>) { + return {children} +} + +export function LI({ + children, + value, +}: React.PropsWithChildren<{value?: string}>) { + const pal = usePalette('default') + return ( + + {value || <>•} + + {children} + + + ) +} + +export function A({children, href}: React.PropsWithChildren<{href: string}>) { + const pal = usePalette('default') + return ( + + ) +} + +const styles = StyleSheet.create({ + h1: { + marginTop: 20, + marginBottom: 10, + letterSpacing: 0.8, + }, + h2: { + marginTop: 20, + marginBottom: 10, + letterSpacing: 0.8, + }, + h3: { + marginBottom: 10, + }, + h4: { + marginBottom: 10, + fontWeight: 'bold', + }, + p: { + marginBottom: 10, + }, + ul: { + marginBottom: 10, + paddingLeft: 18, + }, + ol: { + marginBottom: 10, + paddingLeft: 18, + }, + li: { + flexDirection: 'row', + paddingRight: 10, + marginBottom: 10, + }, + liBullet: { + paddingRight: 10, + }, + liText: {}, + a: { + marginBottom: 10, + }, +}) -- cgit 1.4.1