mirror of
https://github.com/narrrl/holy-flavor-rater.git
synced 2026-11-03 16:41:27 +01:00
desktop bar -> general bar (mobile too)
This commit is contained in:
1 parent
a95a692e1c
commit
0621437546
2 files changed
+18
-12
No files matched your search
@@ -24,7 +24,7 @@ import { useDrawerAnchor } from './hooks/useDrawerAnchor';
|
|||||||
import { NavSidebar } from './components/layout/NavSidebar';
|
import { NavSidebar } from './components/layout/NavSidebar';
|
||||||
import { BrandMark } from './components/layout/BrandMark';
|
import { BrandMark } from './components/layout/BrandMark';
|
||||||
import { DesktopTopBar } from './components/layout/DesktopTopBar';
|
import { DesktopTopBar } from './components/layout/DesktopTopBar';
|
||||||
import { DesktopCategoryBar } from './components/layout/DesktopCategoryBar';
|
import { CategoryBar } from './components/layout/CategoryBar';
|
||||||
import { useCategories } from './api/queries/useCategories';
|
import { useCategories } from './api/queries/useCategories';
|
||||||
import { NotificationMenu } from './components/layout/NotificationMenu';
|
import { NotificationMenu } from './components/layout/NotificationMenu';
|
||||||
import { RequireSuperuser } from './components/auth/RequireSuperuser';
|
import { RequireSuperuser } from './components/auth/RequireSuperuser';
|
||||||
@@ -170,7 +170,7 @@ const App: React.FC = () => {
|
|||||||
</SwipeableDrawer>
|
</SwipeableDrawer>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!isMobile && <DesktopCategoryBar categories={categories} />}
|
<CategoryBar categories={categories} />
|
||||||
|
|
||||||
<Box sx={{ display: 'flex', flexGrow: 1, minHeight: 0 }}>
|
<Box sx={{ display: 'flex', flexGrow: 1, minHeight: 0 }}>
|
||||||
<Box
|
<Box
|
||||||
|
|||||||
+16
-10
@@ -7,16 +7,17 @@ import CollectionsBookmarkOutlinedIcon from '@mui/icons-material/CollectionsBook
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useAuth } from '../../hooks/useAuth';
|
import { useAuth } from '../../hooks/useAuth';
|
||||||
|
|
||||||
export interface DesktopCategoryBarProps {
|
export interface CategoryBarProps {
|
||||||
categories: { name: string; slug: string }[];
|
categories: { name: string; slug: string }[];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Desktop horizontal nav (md+), pinned just under the top bar. Categories are
|
* Horizontal nav pinned just under the top bar on every breakpoint. Categories
|
||||||
* the dominant browse axis here — laid out as a scrollable row of tabs — with
|
* are the dominant browse axis — laid out as a scrollable row of tabs — with
|
||||||
* Home / Community as primary links on the left. Replaces the old left rail.
|
* Home / Community / Dashboard as primary links on the left. Replaces the old
|
||||||
|
* left rail on desktop and mirrors the same sticky chrome on mobile.
|
||||||
*/
|
*/
|
||||||
export const DesktopCategoryBar = ({ categories }: DesktopCategoryBarProps) => {
|
export const CategoryBar = ({ categories }: CategoryBarProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const { user } = useAuth();
|
const { user } = useAuth();
|
||||||
@@ -43,7 +44,7 @@ export const DesktopCategoryBar = ({ categories }: DesktopCategoryBarProps) => {
|
|||||||
component="nav"
|
component="nav"
|
||||||
sx={{
|
sx={{
|
||||||
position: 'sticky',
|
position: 'sticky',
|
||||||
top: 64,
|
top: { xs: 56, sm: 64 },
|
||||||
zIndex: (theme) => theme.zIndex.appBar - 1,
|
zIndex: (theme) => theme.zIndex.appBar - 1,
|
||||||
borderBottom: '1px solid',
|
borderBottom: '1px solid',
|
||||||
borderColor: (theme) => theme.tokens.glass.border,
|
borderColor: (theme) => theme.tokens.glass.border,
|
||||||
@@ -57,17 +58,22 @@ export const DesktopCategoryBar = ({ categories }: DesktopCategoryBarProps) => {
|
|||||||
sx={{
|
sx={{
|
||||||
maxWidth: 1400,
|
maxWidth: 1400,
|
||||||
mx: 'auto',
|
mx: 'auto',
|
||||||
px: { md: 6 },
|
px: { xs: 1, sm: 4, md: 6 },
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
gap: 1,
|
gap: { xs: 0.5, md: 1 },
|
||||||
minHeight: 52,
|
minHeight: { xs: 46, md: 52 },
|
||||||
overflowX: 'auto',
|
overflowX: 'auto',
|
||||||
'&::-webkit-scrollbar': { display: 'none' },
|
'&::-webkit-scrollbar': { display: 'none' },
|
||||||
scrollbarWidth: 'none',
|
scrollbarWidth: 'none',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Button component={Link} to="/" disableRipple sx={{ ...tabSx(isActive('/')), ml: -1.75 }}>
|
<Button
|
||||||
|
component={Link}
|
||||||
|
to="/"
|
||||||
|
disableRipple
|
||||||
|
sx={{ ...tabSx(isActive('/')), ml: { xs: -0.5, md: -1.75 } }}
|
||||||
|
>
|
||||||
<HomeOutlinedIcon sx={{ fontSize: '1.1rem', mr: 0.75 }} />
|
<HomeOutlinedIcon sx={{ fontSize: '1.1rem', mr: 0.75 }} />
|
||||||
{t('nav.home')}
|
{t('nav.home')}
|
||||||
</Button>
|
</Button>
|
||||||
Reference in new issue
Block a user