From 9bf48ed5953bfa25d44f88472bbf56baf3fd634b Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Thu, 23 Feb 2023 09:38:02 -0600 Subject: [PATCH] Change web shell to use permanent header --- src/view/com/util/ViewHeader.web.tsx | 101 +---------------------- src/view/shell/web/DesktopHeader.tsx | 98 ++++++++++++++++++++++ src/view/shell/web/DesktopLeftColumn.tsx | 35 ++------ src/view/shell/web/index.tsx | 15 +++- 4 files changed, 119 insertions(+), 130 deletions(-) create mode 100644 src/view/shell/web/DesktopHeader.tsx diff --git a/src/view/com/util/ViewHeader.web.tsx b/src/view/com/util/ViewHeader.web.tsx index ef70ecab..8f699eaf 100644 --- a/src/view/com/util/ViewHeader.web.tsx +++ b/src/view/com/util/ViewHeader.web.tsx @@ -1,104 +1,9 @@ -import React from 'react' import {observer} from 'mobx-react-lite' -import {StyleSheet, TouchableOpacity, View} from 'react-native' -import {Text} from './text/Text' -import {Link} from './Link' -import {usePalette} from 'lib/hooks/usePalette' -import {useStores} from 'state/index' -import {ComposeIcon, MagnifyingGlassIcon} from 'lib/icons' -import {colors} from 'lib/styles' -export const ViewHeader = observer(function ViewHeader({ - title, -}: { +export const ViewHeader = observer(function ViewHeader(_opts: { title: string canGoBack?: boolean }) { - const store = useStores() - const pal = usePalette('default') - const onPressCompose = () => store.shell.openComposer({}) - return ( - - - - {title} - - - - - - - - New Post - - - - - - Search - - - - ) -}) - -const styles = StyleSheet.create({ - header: { - flexDirection: 'row', - alignItems: 'center', - paddingTop: 24, - paddingBottom: 18, - paddingLeft: 30, - paddingRight: 40, - marginLeft: 300, - borderBottomWidth: 1, - }, - - titleContainer: { - marginRight: 'auto', - }, - title: { - fontWeight: 'bold', - }, - - search: { - flexDirection: 'row', - alignItems: 'center', - width: 300, - borderRadius: 20, - paddingVertical: 8, - paddingHorizontal: 10, - borderWidth: 1, - }, - searchIconWrapper: { - flexDirection: 'row', - width: 30, - justifyContent: 'center', - marginRight: 2, - }, - - newPostBtn: { - flexDirection: 'row', - alignItems: 'center', - justifyContent: 'center', - borderRadius: 24, - paddingTop: 8, - paddingBottom: 9, - paddingHorizontal: 18, - backgroundColor: colors.blue3, - marginRight: 10, - }, - newPostBtnIconWrapper: { - marginRight: 8, - }, - newPostBtnLabel: { - color: colors.white, - }, + // TODO + return null }) diff --git a/src/view/shell/web/DesktopHeader.tsx b/src/view/shell/web/DesktopHeader.tsx new file mode 100644 index 00000000..75acb8da --- /dev/null +++ b/src/view/shell/web/DesktopHeader.tsx @@ -0,0 +1,98 @@ +import React from 'react' +import {observer} from 'mobx-react-lite' +import {StyleSheet, TouchableOpacity, View} from 'react-native' +import {Text} from 'view/com/util/text/Text' +import {Link} from 'view/com/util/Link' +import {usePalette} from 'lib/hooks/usePalette' +import {useStores} from 'state/index' +import {ComposeIcon, MagnifyingGlassIcon} from 'lib/icons' +import {colors} from 'lib/styles' + +export const DesktopHeader = observer(function DesktopHeader({}: { + canGoBack?: boolean +}) { + const store = useStores() + const pal = usePalette('default') + const onPressCompose = () => store.shell.openComposer({}) + return ( + + + + Bluesky + + + + + + + + New Post + + + + + + Search + + + + ) +}) + +const styles = StyleSheet.create({ + header: { + flexDirection: 'row', + alignItems: 'center', + paddingTop: 18, + paddingBottom: 18, + paddingLeft: 30, + paddingRight: 40, + borderBottomWidth: 1, + }, + + titleContainer: { + marginRight: 'auto', + }, + title: {}, + + search: { + flexDirection: 'row', + alignItems: 'center', + width: 300, + borderRadius: 20, + paddingVertical: 8, + paddingHorizontal: 10, + borderWidth: 1, + }, + searchIconWrapper: { + flexDirection: 'row', + width: 30, + justifyContent: 'center', + marginRight: 2, + }, + + newPostBtn: { + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'center', + borderRadius: 24, + paddingTop: 8, + paddingBottom: 9, + paddingHorizontal: 18, + backgroundColor: colors.blue3, + marginRight: 10, + }, + newPostBtnIconWrapper: { + marginRight: 8, + }, + newPostBtnLabel: { + color: colors.white, + }, +}) diff --git a/src/view/shell/web/DesktopLeftColumn.tsx b/src/view/shell/web/DesktopLeftColumn.tsx index 54e3e93e..28c86758 100644 --- a/src/view/shell/web/DesktopLeftColumn.tsx +++ b/src/view/shell/web/DesktopLeftColumn.tsx @@ -1,5 +1,5 @@ import React from 'react' -import {Pressable, StyleSheet, TouchableOpacity, View} from 'react-native' +import {Pressable, StyleSheet, View} from 'react-native' import {observer} from 'mobx-react-lite' import {Link} from '../../com/util/Link' import {Text} from '../../com/util/text/Text' @@ -15,7 +15,6 @@ import { BellIconSolid, MagnifyingGlassIcon, CogIcon, - ComposeIcon, } from 'lib/icons' interface NavItemProps { @@ -40,7 +39,7 @@ export const NavItem = observer( // @ts-ignore Pressable state differs for RNW -prf state.hovered && hoverBg, ]}> - + { const store = useStores() - const containerBg = useColorSchemeStyle( - styles.containerBgLight, - styles.containerBgDark, - ) const pal = usePalette('default') const avi = ( { /> ) return ( - + - - Bluesky - { icon={} iconFilled={} /> - - + { }) const styles = StyleSheet.create({ - containerBgLight: { - backgroundColor: '#f9f9fd', - }, - containerBgDark: { - backgroundColor: '#f9f9fd', // TODO - }, - container: { position: 'absolute', - left: 0, + left: 5, + top: 100, width: '300px', - height: '100vh', - borderRightWidth: 1, - paddingTop: 5, }, main: { flex: 1, @@ -155,11 +137,6 @@ const styles = StyleSheet.create({ marginHorizontal: 8, }, - logo: { - paddingTop: 8, - paddingBottom: 14, - }, - navItem: { paddingVertical: 8, paddingHorizontal: 6, diff --git a/src/view/shell/web/index.tsx b/src/view/shell/web/index.tsx index 7d76c01d..44f958be 100644 --- a/src/view/shell/web/index.tsx +++ b/src/view/shell/web/index.tsx @@ -5,6 +5,7 @@ import {IconProp} from '@fortawesome/fontawesome-svg-core' import {useStores} from 'state/index' import {NavigationModel} from 'state/models/navigation' import {match, MatchResult} from '../../routes' +import {DesktopHeader} from './DesktopHeader' import {DesktopLeftColumn} from './DesktopLeftColumn' import {DesktopRightColumn} from './DesktopRightColumn' import {Onboard} from '../../screens/Onboard' @@ -14,10 +15,11 @@ import {Lightbox} from '../../com/lightbox/Lightbox' import {Modal} from '../../com/modals/Modal' import {Composer} from './Composer' import {usePalette} from 'lib/hooks/usePalette' -import {s} from 'lib/styles' +import {useColorSchemeStyle} from 'lib/hooks/useColorSchemeStyle' +import {s, colors} from 'lib/styles' export const WebShell: React.FC = observer(() => { - const pal = usePalette('default') + const pageBg = useColorSchemeStyle(styles.bgLight, styles.bgDark) const store = useStores() const screenRenderDesc = constructScreenRenderDesc(store.nav) @@ -40,7 +42,8 @@ export const WebShell: React.FC = observer(() => { } return ( - + + {screenRenderDesc.screens.map(({Com, navIdx, params, key, current}) => (