From 1ccb3be961795c569c8c1eb64ca0617bd6548e79 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 22 Feb 2024 16:03:20 +0000 Subject: Refactor feed header components (#2964) * Move home-related files to view/com/home * Add HomeHeader in front of FeedTabBar * Move isDekstop check outside FeedsTabBar * Remove PWI logic from tabbar * Separate platform-specific layout from shared logic --- src/view/com/home/HomeHeaderLayoutMobile.tsx | 119 +++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 src/view/com/home/HomeHeaderLayoutMobile.tsx (limited to 'src/view/com/home/HomeHeaderLayoutMobile.tsx') diff --git a/src/view/com/home/HomeHeaderLayoutMobile.tsx b/src/view/com/home/HomeHeaderLayoutMobile.tsx new file mode 100644 index 000000000..0478f69a4 --- /dev/null +++ b/src/view/com/home/HomeHeaderLayoutMobile.tsx @@ -0,0 +1,119 @@ +import React from 'react' +import {StyleSheet, TouchableOpacity, View} from 'react-native' +import {usePalette} from 'lib/hooks/usePalette' +import {Link} from '../util/Link' +import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' +import {FontAwesomeIconStyle} from '@fortawesome/react-native-fontawesome' +import {HITSLOP_10} from 'lib/constants' +import Animated from 'react-native-reanimated' +import {msg} from '@lingui/macro' +import {useLingui} from '@lingui/react' +import {useMinimalShellMode} from 'lib/hooks/useMinimalShellMode' +import {useSetDrawerOpen} from '#/state/shell/drawer-open' +import {useShellLayout} from '#/state/shell/shell-layout' +import {isWeb} from 'platform/detection' +import {Logo} from '#/view/icons/Logo' + +import {IS_DEV} from '#/env' +import {atoms} from '#/alf' +import {Link as Link2} from '#/components/Link' +import {ColorPalette_Stroke2_Corner0_Rounded as ColorPalette} from '#/components/icons/ColorPalette' + +export function HomeHeaderLayoutMobile({ + children, +}: { + children: React.ReactNode +}) { + const pal = usePalette('default') + const {_} = useLingui() + const setDrawerOpen = useSetDrawerOpen() + const {headerHeight} = useShellLayout() + const {headerMinimalShellTransform} = useMinimalShellMode() + + const onPressAvi = React.useCallback(() => { + setDrawerOpen(true) + }, [setDrawerOpen]) + + return ( + { + headerHeight.value = e.nativeEvent.layout.height + }}> + + + + + + + + + + + {IS_DEV && ( + + + + )} + + + + + + {children} + + ) +} + +const styles = StyleSheet.create({ + tabBar: { + // @ts-ignore web-only + position: isWeb ? 'fixed' : 'absolute', + zIndex: 1, + left: 0, + right: 0, + top: 0, + flexDirection: 'column', + borderBottomWidth: 1, + }, + topBar: { + flexDirection: 'row', + justifyContent: 'space-between', + alignItems: 'center', + paddingHorizontal: 18, + paddingVertical: 8, + width: '100%', + }, + title: { + fontSize: 21, + }, +}) -- cgit 1.4.1