diff --git a/src/components/AppNavbar.tsx b/src/components/AppNavbar.tsx index 1282be41..fe066a8c 100644 --- a/src/components/AppNavbar.tsx +++ b/src/components/AppNavbar.tsx @@ -23,12 +23,19 @@ export const AppNavbar = (): JSX.Element => { justify="space-between" align="center" px={{ base: '1.5rem', md: '1.8rem', xl: '2rem' }} + pl={{ base: `calc(1rem + ${ADMIN_NAVBAR_HEIGHT})`, sm: '1.5rem' }} py="0.375rem" bg="white" borderBottomWidth="1px" borderColor="base.divider.medium" + transition="padding 0.1s" > - + { + const [showWhenSmallMobile, setShowWhenSmallMobile] = useState(false) const isMobile = useIsMobile() const { me } = useMe() + const breakpointValue = useBreakpoint() const { pathname, query } = useRouter() + const mobileButtonProps = { + zIndex: 'overlay', + colorScheme: 'neutral', + border: '0px', + borderRight: '1px', + boxSize: ADMIN_NAVBAR_HEIGHT, + borderRadius: '0px', + borderColor: 'base.divider.medium', + display: { base: 'inline-flex', sm: 'none' }, + } + const isProfileActive = useMemo(() => { if (pathname === SETTINGS_PROFILE) return true if ( @@ -26,19 +45,53 @@ export const DashSidebar = () => { return true }, [pathname, query.username, me?.username]) + const showText = isMobile && breakpointValue === 'sm' + return ( - + + {showWhenSmallMobile ? ( + setShowWhenSmallMobile(false)} + bg="slate.100" + /> + ) : ( + setShowWhenSmallMobile(true)} + bg="white" + variant="clear" + icon={} + /> + )} { href={HOME} isActive={pathname === HOME} title="Home" - px={{ base: '0.75rem', md: '1rem' }} + px={{ base: '1.125rem', sm: '0.75rem', md: '1rem' }} borderRadius={{ base: 0, md: 'md' }} + onClick={() => setShowWhenSmallMobile(false)} > - {isMobile ? '' : 'Home'} + {showText ? '' : 'Home'} { href={`${PROFILE}/${me?.username}`} isActive={isProfileActive} title="Profile" - px={{ base: '0.75rem', md: '1rem' }} + px={{ base: '1.125rem', sm: '0.75rem', md: '1rem' }} borderRadius={{ base: 0, md: 'md' }} + onClick={() => setShowWhenSmallMobile(false)} > - {isMobile ? '' : 'Profile'} + {showText ? '' : 'Profile'} diff --git a/src/pages/home.tsx b/src/pages/home.tsx index 1a0c389c..cded50c4 100644 --- a/src/pages/home.tsx +++ b/src/pages/home.tsx @@ -1,7 +1,11 @@ import { Box, Flex } from '@chakra-ui/react' import { SkeletonPostList } from '~/components/SkeletonPostList' import Suspense from '~/components/Suspense' -import { APP_GRID_COLUMN, APP_GRID_TEMPLATE_COLUMN } from '~/constants/layouts' +import { + ADMIN_NAVBAR_HEIGHT, + APP_GRID_COLUMN, + APP_GRID_TEMPLATE_COLUMN, +} from '~/constants/layouts' import { NewPostBanner, PostList } from '~/features/home/components' import { type NextPageWithLayout } from '~/lib/types' import { AppGrid } from '~/templates/AppGrid' @@ -9,7 +13,13 @@ import { AdminLayout } from '~/templates/layouts/AdminLayout' const Home: NextPageWithLayout = () => { return ( - + { const username = String(query.username) return ( - + { - {page} + + {page} + )