diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-08-29 22:56:13 -0700 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2023-08-29 22:56:13 -0700 |
commit | 5e765bf1cb29d30d627552da84d02594f506af1f (patch) | |
tree | 4620266dbd31e9ec525e173bb07652ff0b804ba7 /src/view/com/util/layouts/TitleColumnLayout.tsx | |
parent | 5d9534ca7258e6165e537b89d999a8c494501dc0 (diff) | |
download | voidsky-5e765bf1cb29d30d627552da84d02594f506af1f.tar.zst |
Rework web onboarding
Diffstat (limited to 'src/view/com/util/layouts/TitleColumnLayout.tsx')
-rw-r--r-- | src/view/com/util/layouts/TitleColumnLayout.tsx | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/view/com/util/layouts/TitleColumnLayout.tsx b/src/view/com/util/layouts/TitleColumnLayout.tsx new file mode 100644 index 000000000..3ca10868e --- /dev/null +++ b/src/view/com/util/layouts/TitleColumnLayout.tsx @@ -0,0 +1,62 @@ +import React from 'react' +import {StyleProp, StyleSheet, View, ViewStyle} from 'react-native' +import {usePalette} from 'lib/hooks/usePalette' + +interface Props { + testID?: string + title: React.Component + horizontal: boolean + titleStyle?: StyleProp<ViewStyle> + contentStyle?: StyleProp<ViewStyle> +} + +export function TitleColumnLayout({ + testID, + title, + horizontal, + children, + titleStyle, + contentStyle, +}: React.PropsWithChildren<Props>) { + const pal = usePalette('default') + + const layoutStyles = horizontal ? styles2Column : styles1Column + return ( + <View testID={testID} style={layoutStyles.container}> + <View style={[layoutStyles.title, pal.viewLight, titleStyle]}> + {title} + </View> + <View style={[layoutStyles.content, contentStyle]}>{children}</View> + </View> + ) +} + +const styles2Column = StyleSheet.create({ + container: { + flexDirection: 'row', + height: '100%', + }, + title: { + flex: 1, + paddingHorizontal: 40, + paddingBottom: 80, + justifyContent: 'center', + }, + content: { + flex: 2, + paddingHorizontal: 40, + justifyContent: 'center', + }, +}) + +const styles1Column = StyleSheet.create({ + container: {}, + title: { + paddingHorizontal: 40, + paddingVertical: 40, + }, + content: { + paddingHorizontal: 40, + paddingVertical: 40, + }, +}) |