diff --git a/.changeset/fix-main-navigation-scrollbar.md b/.changeset/fix-main-navigation-scrollbar.md new file mode 100644 index 00000000000..f6d9f3aed1b --- /dev/null +++ b/.changeset/fix-main-navigation-scrollbar.md @@ -0,0 +1,5 @@ +--- +"@comet/admin": patch +--- + +Fix scrollbar overlapping icons in MainNavigation by adding `overflow-y: auto` and `scrollbar-gutter: stable` diff --git a/packages/admin/admin/src/mui/mainNavigation/MainNavigation.styles.ts b/packages/admin/admin/src/mui/mainNavigation/MainNavigation.styles.ts index 9df85da5b18..2d048982b0d 100644 --- a/packages/admin/admin/src/mui/mainNavigation/MainNavigation.styles.ts +++ b/packages/admin/admin/src/mui/mainNavigation/MainNavigation.styles.ts @@ -30,6 +30,13 @@ export type OwnerState = { const getSharedStyles = (theme: Theme, headerHeight: number) => css` background-color: ${theme.palette.common.white}; overflow-x: hidden; + overflow-y: auto; + scrollbar-width: none; + + &::-webkit-scrollbar { + display: none; + } + height: calc(100% - ${headerHeight}px); top: ${headerHeight}px; diff --git a/storybook/src/admin/mui/Menu.stories.tsx b/storybook/src/admin/mui/Menu.stories.tsx index e5d0bd6bcf7..c60083b3b9a 100644 --- a/storybook/src/admin/mui/Menu.stories.tsx +++ b/storybook/src/admin/mui/Menu.stories.tsx @@ -12,7 +12,25 @@ import { MasterLayout, useWindowSize, } from "@comet/admin"; -import { CometColor, Dashboard, Settings, Sort } from "@comet/admin-icons"; +import { + Account, + Archive, + Assets, + Calendar, + CometColor, + Dashboard, + Document, + File, + Folder, + Language, + Link, + Mail, + Preview, + Settings, + Sort, + Tag, + Wrench, +} from "@comet/admin-icons"; import { Card, CardContent, Typography } from "@mui/material"; import { Route, Switch } from "react-router"; @@ -100,3 +118,87 @@ export const _Menu = { parameters: { layout: "fullscreen" }, }; + +const AppMenuWithManyItems = () => { + const windowSize = useWindowSize(); + + return ( + + + } to="/dashboard" /> + } to="/pages" /> + } to="/assets" /> + } to="/files" /> + } to="/folders" /> + }> + + + + + + + } to="/email" /> + } to="/newsletters" /> + } to="/preview" /> + }> + + + + + + + + } to="/links" /> + } to="/calendar" /> + } to="/archive" /> + } to="/accounts" /> + + + } to="/settings" /> + } to="/configuration" /> + } to="/sort" /> + } + /> + + + ); +}; + +export const MenuWithManyItems = { + render: () => ( + + + Root} /> + Dashboard} /> + Pages} /> + Assets} /> + Files} /> + Folders} /> + Blog Posts} /> + Blog Categories} /> + Blog Tags} /> + Email Campaigns} /> + Newsletters} /> + Preview} /> + English} /> + German} /> + French} /> + Spanish} /> + Links} /> + Calendar} /> + Archive} /> + Accounts} /> + Settings} /> + Configuration} /> + Sort} /> + + + ), + + parameters: { layout: "fullscreen" }, +};