make the dashboard sidebar responsive on mobile
This commit is contained in:
parent
0440ea0d0a
commit
dd24443670
@ -53,23 +53,25 @@ const OrganizationSelector = (): ReactElement => {
|
|||||||
<Popover open={open} onOpenChange={setOpen}>
|
<Popover open={open} onOpenChange={setOpen}>
|
||||||
<PopoverTrigger asChild>
|
<PopoverTrigger asChild>
|
||||||
<Button
|
<Button
|
||||||
className="w-52 bg-background/30 justify-between"
|
className="px-1.5 w-14 md:w-52 md:px-4 bg-background/30 justify-between transition-all transform-gpu"
|
||||||
aria-expanded={open}
|
aria-expanded={open}
|
||||||
variant="outline"
|
variant="outline"
|
||||||
role="combobox"
|
role="combobox"
|
||||||
>
|
>
|
||||||
{selected ? (
|
{selected ? (
|
||||||
<div className="flex gap-3.5 items-center">
|
<div className="flex gap-1 items-center">
|
||||||
<OrganizationLogo
|
<OrganizationLogo
|
||||||
organization={selected}
|
organization={selected}
|
||||||
size="sm"
|
size="sm"
|
||||||
/>
|
/>
|
||||||
{selected.name}
|
<span className="hidden md:flex">
|
||||||
|
{selected.name}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
"Select organization..."
|
"Select organization..."
|
||||||
)}
|
)}
|
||||||
<ChevronsUpDownIcon className="ml-2 w-4 h-4 shrink-0 opacity-50" />
|
<ChevronsUpDownIcon className="md:ml-2 w-4 h-4 shrink-0 opacity-50" />
|
||||||
</Button>
|
</Button>
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
<PopoverContent className="w-56 p-0">
|
<PopoverContent className="w-56 p-0">
|
||||||
|
@ -5,15 +5,7 @@ import { SidebarLink } from "@/app/types/dashboard/sidebar-link";
|
|||||||
import SimpleTooltip from "@/components/simple-tooltip";
|
import SimpleTooltip from "@/components/simple-tooltip";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import {
|
import { ClipboardIcon, HomeIcon } from "@heroicons/react/24/outline";
|
||||||
ChartBarSquareIcon,
|
|
||||||
ClipboardIcon,
|
|
||||||
Cog6ToothIcon,
|
|
||||||
FireIcon,
|
|
||||||
HomeIcon,
|
|
||||||
PencilSquareIcon,
|
|
||||||
WrenchIcon,
|
|
||||||
} from "@heroicons/react/24/outline";
|
|
||||||
import { useOrganizationContext } from "@/app/provider/organization-provider";
|
import { useOrganizationContext } from "@/app/provider/organization-provider";
|
||||||
import { OrganizationState } from "@/app/store/organization-store";
|
import { OrganizationState } from "@/app/store/organization-store";
|
||||||
import { usePathname } from "next/navigation";
|
import { usePathname } from "next/navigation";
|
||||||
@ -30,31 +22,31 @@ const links: SidebarLink[] = [
|
|||||||
icon: <ClipboardIcon />,
|
icon: <ClipboardIcon />,
|
||||||
href: "/dashboard/org/status-pages",
|
href: "/dashboard/org/status-pages",
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
name: "Automations",
|
// name: "Automations",
|
||||||
icon: <WrenchIcon />,
|
// icon: <WrenchIcon />,
|
||||||
href: "/dashboard/org/automations",
|
// href: "/dashboard/org/automations",
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
name: "Incidents",
|
// name: "Incidents",
|
||||||
icon: <FireIcon />,
|
// icon: <FireIcon />,
|
||||||
href: "/dashboard/org/incidents",
|
// href: "/dashboard/org/incidents",
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
name: "Insights",
|
// name: "Insights",
|
||||||
icon: <ChartBarSquareIcon />,
|
// icon: <ChartBarSquareIcon />,
|
||||||
href: "/dashboard/org/insights",
|
// href: "/dashboard/org/insights",
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
name: "Audit Logs",
|
// name: "Audit Logs",
|
||||||
icon: <PencilSquareIcon />,
|
// icon: <PencilSquareIcon />,
|
||||||
href: "/dashboard/org/audit",
|
// href: "/dashboard/org/audit",
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
name: "Settings",
|
// name: "Settings",
|
||||||
icon: <Cog6ToothIcon />,
|
// icon: <Cog6ToothIcon />,
|
||||||
href: "/dashboard/org/settings",
|
// href: "/dashboard/org/settings",
|
||||||
},
|
// },
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -87,7 +79,7 @@ const Links = (): ReactElement => {
|
|||||||
>
|
>
|
||||||
<Link
|
<Link
|
||||||
className={cn(
|
className={cn(
|
||||||
"px-3 py-2 flex gap-2 items-center text-sm rounded-lg hover:bg-zinc-800 transition-all transform-gpu",
|
"px-2.5 md:px-3 py-2 flex gap-2 items-center text-sm rounded-lg hover:bg-zinc-800 transition-all transform-gpu",
|
||||||
active && "font-medium bg-zinc-800"
|
active && "font-medium bg-zinc-800"
|
||||||
)}
|
)}
|
||||||
href={link.href}
|
href={link.href}
|
||||||
@ -95,7 +87,9 @@ const Links = (): ReactElement => {
|
|||||||
<div className="relative w-5 h-5">
|
<div className="relative w-5 h-5">
|
||||||
{link.icon}
|
{link.icon}
|
||||||
</div>
|
</div>
|
||||||
{link.name}
|
<span className="hidden md:flex">
|
||||||
|
{link.name}
|
||||||
|
</span>
|
||||||
</Link>
|
</Link>
|
||||||
</SimpleTooltip>
|
</SimpleTooltip>
|
||||||
);
|
);
|
||||||
|
@ -23,7 +23,7 @@ const Sidebar = (): ReactElement => {
|
|||||||
(state: UserState) => state.user
|
(state: UserState) => state.user
|
||||||
);
|
);
|
||||||
return hasFlag(user as User, UserFlag.COMPLETED_ONBOARDING) ? (
|
return hasFlag(user as User, UserFlag.COMPLETED_ONBOARDING) ? (
|
||||||
<nav className="w-56 px-3 py-4 h-screen flex flex-col items-center bg-zinc-900 border-r">
|
<nav className="w-16 md:w-56 px-3 py-4 h-screen flex flex-col items-center bg-zinc-900 border-r transition-all transform-gpu">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<Link
|
<Link
|
||||||
className="flex gap-4 items-center select-none group"
|
className="flex gap-4 items-center select-none group"
|
||||||
@ -31,11 +31,11 @@ const Sidebar = (): ReactElement => {
|
|||||||
draggable={false}
|
draggable={false}
|
||||||
>
|
>
|
||||||
<Branding size="xs" />
|
<Branding size="xs" />
|
||||||
<h1 className="text-2xl font-bold group-hover:opacity-75 transition-all transform-gpu">
|
<h1 className="hidden opacity-0 md:flex md:opacity-100 text-2xl font-bold group-hover:opacity-75 transition-all transform-gpu">
|
||||||
Pulse App
|
Pulse App
|
||||||
</h1>
|
</h1>
|
||||||
</Link>
|
</Link>
|
||||||
<Separator className="w-48 my-3.5" />
|
<Separator className="w-12 md:w-48 my-3.5 transition-all transform-gpu" />
|
||||||
|
|
||||||
{/* Content */}
|
{/* Content */}
|
||||||
<OrganizationSelector />
|
<OrganizationSelector />
|
||||||
|
@ -79,9 +79,11 @@ const UserMenu = (): ReactElement => {
|
|||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
<DropdownMenuTrigger>
|
<DropdownMenuTrigger>
|
||||||
<SimpleTooltip content="My account">
|
<SimpleTooltip content="My account">
|
||||||
<div className="px-5 py-2 flex gap-2.5 items-center font-medium bg-background/30 border hover:opacity-75 rounded-lg transition-all transform-gpu">
|
<div className="px-2.5 md:px-5 py-2 flex gap-2.5 items-center font-medium bg-background/30 border hover:opacity-75 rounded-lg transition-all transform-gpu">
|
||||||
<UserAvatar user={user as User} size="sm" />@
|
<UserAvatar user={user as User} size="sm" />
|
||||||
{user?.username}
|
<span className="hidden md:flex">
|
||||||
|
@{user?.username}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</SimpleTooltip>
|
</SimpleTooltip>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user