diff options
author | Paul Frazee <pfrazee@gmail.com> | 2022-11-28 09:29:35 -0600 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2022-11-28 09:29:35 -0600 |
commit | 1784a4912d874796301503d21669888ce4361e8b (patch) | |
tree | 29b776dba4997f346c0746da5ff1fb698a144156 /src/view/com/util/ViewHeader.tsx | |
parent | cb5210d24d0e26fc51722dc51e58d939e2e8f316 (diff) | |
download | voidsky-1784a4912d874796301503d21669888ce4361e8b.tar.zst |
Enlarge the view header, left align the title, and add a compose button
Diffstat (limited to 'src/view/com/util/ViewHeader.tsx')
-rw-r--r-- | src/view/com/util/ViewHeader.tsx | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/src/view/com/util/ViewHeader.tsx b/src/view/com/util/ViewHeader.tsx index 55a71ea26..50b7e6532 100644 --- a/src/view/com/util/ViewHeader.tsx +++ b/src/view/com/util/ViewHeader.tsx @@ -1,7 +1,6 @@ import React from 'react' import {StyleSheet, Text, TouchableOpacity, View} from 'react-native' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' -import {UserAvatar} from './UserAvatar' import {colors} from '../../lib/styles' import {MagnifyingGlassIcon} from '../../lib/icons' import {useStores} from '../../../state' @@ -9,14 +8,19 @@ import {useStores} from '../../../state' export function ViewHeader({ title, subtitle, + onPost, }: { title: string subtitle?: string + onPost?: () => void }) { const store = useStores() const onPressBack = () => { store.nav.tab.goBack() } + const onPressCompose = () => { + store.shell.openComposer({onPost}) + } const onPressSearch = () => { store.nav.navigate(`/search`) } @@ -26,9 +30,7 @@ export function ViewHeader({ <TouchableOpacity onPress={onPressBack} style={styles.backIcon}> <FontAwesomeIcon size={18} icon="angle-left" style={{marginTop: 6}} /> </TouchableOpacity> - ) : ( - <View style={styles.cornerPlaceholder} /> - )} + ) : undefined} <View style={styles.titleContainer}> <Text style={styles.title}>{title}</Text> {subtitle ? ( @@ -37,8 +39,17 @@ export function ViewHeader({ </Text> ) : undefined} </View> - <TouchableOpacity onPress={onPressSearch} style={styles.searchBtn}> - <MagnifyingGlassIcon size={17} style={styles.searchBtnIcon} /> + <TouchableOpacity onPress={onPressCompose} style={styles.btn}> + <FontAwesomeIcon size={18} icon="plus" /> + </TouchableOpacity> + <TouchableOpacity + onPress={onPressSearch} + style={[styles.btn, {marginLeft: 8}]}> + <MagnifyingGlassIcon + size={18} + strokeWidth={3} + style={styles.searchBtnIcon} + /> </TouchableOpacity> </View> ) @@ -59,33 +70,28 @@ const styles = StyleSheet.create({ titleContainer: { flexDirection: 'row', alignItems: 'baseline', - marginLeft: 'auto', marginRight: 'auto', }, title: { - fontSize: 16, + fontSize: 21, fontWeight: '600', }, subtitle: { - fontSize: 15, - marginLeft: 3, + fontSize: 18, + marginLeft: 6, color: colors.gray4, maxWidth: 200, }, - cornerPlaceholder: { - width: 30, - height: 30, - }, backIcon: {width: 30, height: 30}, - searchBtn: { + btn: { flexDirection: 'row', alignItems: 'center', justifyContent: 'center', backgroundColor: colors.gray1, - width: 30, - height: 30, - borderRadius: 15, + width: 36, + height: 36, + borderRadius: 20, }, searchBtnIcon: { color: colors.black, |