From 764c7cd5694a41c98d8543b68d7791fa90db4291 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Tue, 5 Sep 2023 10:42:19 -0700 Subject: Updates to use dynamic/responsive styles on web (#1351) * Move most responsive queries to the hook * Fix invalid CSS value * Fixes to tablet render of post thread * Fix overflow issues on web * Fix search header on tablet * Fix QP margin in web composer * Fix: only apply double gutter once to flatlist (close #1368) * Fix styles on discover feeds header * Fix double discover links in multifeed --- src/view/shell/desktop/LeftNav.tsx | 147 ++++++++++++++++++++++++++++++------- 1 file changed, 119 insertions(+), 28 deletions(-) (limited to 'src/view/shell/desktop/LeftNav.tsx') diff --git a/src/view/shell/desktop/LeftNav.tsx b/src/view/shell/desktop/LeftNav.tsx index 50d482fda..087455d3f 100644 --- a/src/view/shell/desktop/LeftNav.tsx +++ b/src/view/shell/desktop/LeftNav.tsx @@ -17,6 +17,7 @@ import {Link} from 'view/com/util/Link' import {LoadingPlaceholder} from 'view/com/util/LoadingPlaceholder' import {usePalette} from 'lib/hooks/usePalette' import {useStores} from 'state/index' +import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' import {s, colors} from 'lib/styles' import { HomeIcon, @@ -41,18 +42,28 @@ import {makeProfileLink} from 'lib/routes/links' const ProfileCard = observer(() => { const store = useStores() + const {isDesktop} = useWebMediaQueries() + const size = isDesktop ? 64 : 48 return store.me.handle ? ( - - + + ) : ( - - + + ) }) function BackBtn() { + const {isTablet} = useWebMediaQueries() const pal = usePalette('default') const navigation = useNavigation() const shouldShow = useNavigationState(state => !isStateAtTabRoot(state)) @@ -65,7 +76,7 @@ function BackBtn() { } }, [navigation]) - if (!shouldShow) { + if (!shouldShow || isTablet) { return <> } return ( @@ -96,6 +107,7 @@ const NavItem = observer( ({count, href, icon, iconFilled, label}: NavItemProps) => { const pal = usePalette('default') const store = useStores() + const {isDesktop, isTablet} = useWebMediaQueries() const [pathName] = React.useMemo(() => router.matchPath(href), [href]) const currentRouteInfo = useNavigationState(state => { if (!state) { @@ -137,17 +149,28 @@ const NavItem = observer( accessibilityRole="tab" accessibilityLabel={label} accessibilityHint=""> - + {isCurrent ? iconFilled : icon} {typeof count === 'string' && count ? ( - + {count} ) : null} - - {label} - + {isDesktop && ( + + {label} + + )} ) }, @@ -156,6 +179,7 @@ const NavItem = observer( function ComposeBtn() { const store = useStores() const {getState} = useNavigation() + const {isTablet} = useWebMediaQueries() const getProfileHandle = () => { const {routes} = getState() @@ -172,6 +196,9 @@ function ComposeBtn() { const onPressCompose = () => store.shell.openComposer({mention: getProfileHandle()}) + if (isTablet) { + return null + } return ( + {store.session.hasSession && } } + icon={} iconFilled={ - + } label="Home" /> + } iconFilled={ } @@ -229,14 +271,14 @@ export const DesktopLeftNav = observer(function DesktopLeftNav() { } iconFilled={ } label="My Feeds" @@ -244,9 +286,19 @@ export const DesktopLeftNav = observer(function DesktopLeftNav() { } + icon={ + + } iconFilled={ - + } label="Notifications" /> @@ -256,14 +308,14 @@ export const DesktopLeftNav = observer(function DesktopLeftNav() { } iconFilled={ } label="Moderation" @@ -271,18 +323,38 @@ export const DesktopLeftNav = observer(function DesktopLeftNav() { {store.session.hasSession && ( } + icon={ + + } iconFilled={ - + } label="Profile" /> )} } + icon={ + + } iconFilled={ - + } label="Settings" /> @@ -300,12 +372,24 @@ const styles = StyleSheet.create({ maxHeight: 'calc(100vh - 10px)', overflowY: 'auto', }, + leftNavTablet: { + top: 0, + left: 0, + right: 'auto', + borderRightWidth: 1, + height: '100%', + width: 76, + alignItems: 'center', + }, profileCard: { marginVertical: 10, width: 90, paddingLeft: 12, }, + profileCardTablet: { + width: 70, + }, backBtn: { position: 'absolute', @@ -330,6 +414,10 @@ const styles = StyleSheet.create({ height: 28, marginTop: 2, }, + navItemIconWrapperTablet: { + width: 40, + height: 40, + }, navItemCount: { position: 'absolute', top: 0, @@ -341,6 +429,10 @@ const styles = StyleSheet.create({ paddingHorizontal: 4, borderRadius: 6, }, + navItemCountTablet: { + left: 18, + fontSize: 14, + }, newPostBtn: { flexDirection: 'row', @@ -354,10 +446,9 @@ const styles = StyleSheet.create({ marginLeft: 12, marginTop: 20, marginBottom: 10, + gap: 8, }, - newPostBtnIconWrapper: { - marginRight: 8, - }, + newPostBtnIconWrapper: {}, newPostBtnLabel: { color: colors.white, fontSize: 16, -- cgit 1.4.1