Files
bsky-social-app/src/view/shell/desktop-web/left-column.tsx
T
Paul Frazee 97f52b6a03 New navigation model (#1)
* Flatten all routing into a single stack

* Replace router with custom implementation

* Add shell header and titles

* Add tab selector

* Add back/forward history menus on longpress

* Fix: don't modify state during render

* Add refresh() to navigation and reroute navigations to the current location to refresh instead of add to history

* Cache screens during navigation to maintain scroll position and improve load-time for renders
2022-08-31 14:36:50 -05:00

56 lines
1.2 KiB
TypeScript

import React from 'react'
import {Pressable, View, StyleSheet} from 'react-native'
export const NavItem: React.FC<{label: string; screen: string}> = ({
label,
screen,
}) => {
const Link = <></> // TODO
return (
<View>
<Pressable
style={state => [
// @ts-ignore it does exist! (react-native-web) -prf
state.hovered && styles.navItemHovered,
]}>
<Link
style={[
styles.navItemLink,
false /* TODO route.name === screen*/ && styles.navItemLinkSelected,
]}
to={{screen, params: {}}}>
{label}
</Link>
</Pressable>
</View>
)
}
export const DesktopLeftColumn: React.FC = () => {
return (
<View style={styles.container}>
<NavItem screen="Home" label="Home" />
<NavItem screen="Search" label="Search" />
<NavItem screen="Notifications" label="Notifications" />
</View>
)
}
const styles = StyleSheet.create({
container: {
position: 'absolute',
left: 'calc(50vw - 500px)',
width: '200px',
height: '100%',
},
navItemHovered: {
backgroundColor: 'gray',
},
navItemLink: {
padding: '1rem',
},
navItemLinkSelected: {
color: 'blue',
},
})