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}>
|
||||
<PopoverTrigger asChild>
|
||||
<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}
|
||||
variant="outline"
|
||||
role="combobox"
|
||||
>
|
||||
{selected ? (
|
||||
<div className="flex gap-3.5 items-center">
|
||||
<div className="flex gap-1 items-center">
|
||||
<OrganizationLogo
|
||||
organization={selected}
|
||||
size="sm"
|
||||
/>
|
||||
{selected.name}
|
||||
<span className="hidden md:flex">
|
||||
{selected.name}
|
||||
</span>
|
||||
</div>
|
||||
) : (
|
||||
"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>
|
||||
</PopoverTrigger>
|
||||
<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 Link from "next/link";
|
||||
import { cn } from "@/lib/utils";
|
||||
import {
|
||||
ChartBarSquareIcon,
|
||||
ClipboardIcon,
|
||||
Cog6ToothIcon,
|
||||
FireIcon,
|
||||
HomeIcon,
|
||||
PencilSquareIcon,
|
||||
WrenchIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { ClipboardIcon, HomeIcon } from "@heroicons/react/24/outline";
|
||||
import { useOrganizationContext } from "@/app/provider/organization-provider";
|
||||
import { OrganizationState } from "@/app/store/organization-store";
|
||||
import { usePathname } from "next/navigation";
|
||||
@ -30,31 +22,31 @@ const links: SidebarLink[] = [
|
||||
icon: <ClipboardIcon />,
|
||||
href: "/dashboard/org/status-pages",
|
||||
},
|
||||
{
|
||||
name: "Automations",
|
||||
icon: <WrenchIcon />,
|
||||
href: "/dashboard/org/automations",
|
||||
},
|
||||
{
|
||||
name: "Incidents",
|
||||
icon: <FireIcon />,
|
||||
href: "/dashboard/org/incidents",
|
||||
},
|
||||
{
|
||||
name: "Insights",
|
||||
icon: <ChartBarSquareIcon />,
|
||||
href: "/dashboard/org/insights",
|
||||
},
|
||||
{
|
||||
name: "Audit Logs",
|
||||
icon: <PencilSquareIcon />,
|
||||
href: "/dashboard/org/audit",
|
||||
},
|
||||
{
|
||||
name: "Settings",
|
||||
icon: <Cog6ToothIcon />,
|
||||
href: "/dashboard/org/settings",
|
||||
},
|
||||
// {
|
||||
// name: "Automations",
|
||||
// icon: <WrenchIcon />,
|
||||
// href: "/dashboard/org/automations",
|
||||
// },
|
||||
// {
|
||||
// name: "Incidents",
|
||||
// icon: <FireIcon />,
|
||||
// href: "/dashboard/org/incidents",
|
||||
// },
|
||||
// {
|
||||
// name: "Insights",
|
||||
// icon: <ChartBarSquareIcon />,
|
||||
// href: "/dashboard/org/insights",
|
||||
// },
|
||||
// {
|
||||
// name: "Audit Logs",
|
||||
// icon: <PencilSquareIcon />,
|
||||
// href: "/dashboard/org/audit",
|
||||
// },
|
||||
// {
|
||||
// name: "Settings",
|
||||
// icon: <Cog6ToothIcon />,
|
||||
// href: "/dashboard/org/settings",
|
||||
// },
|
||||
];
|
||||
|
||||
/**
|
||||
@ -87,7 +79,7 @@ const Links = (): ReactElement => {
|
||||
>
|
||||
<Link
|
||||
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"
|
||||
)}
|
||||
href={link.href}
|
||||
@ -95,7 +87,9 @@ const Links = (): ReactElement => {
|
||||
<div className="relative w-5 h-5">
|
||||
{link.icon}
|
||||
</div>
|
||||
{link.name}
|
||||
<span className="hidden md:flex">
|
||||
{link.name}
|
||||
</span>
|
||||
</Link>
|
||||
</SimpleTooltip>
|
||||
);
|
||||
|
@ -23,7 +23,7 @@ const Sidebar = (): ReactElement => {
|
||||
(state: UserState) => state.user
|
||||
);
|
||||
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 */}
|
||||
<Link
|
||||
className="flex gap-4 items-center select-none group"
|
||||
@ -31,11 +31,11 @@ const Sidebar = (): ReactElement => {
|
||||
draggable={false}
|
||||
>
|
||||
<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
|
||||
</h1>
|
||||
</Link>
|
||||
<Separator className="w-48 my-3.5" />
|
||||
<Separator className="w-12 md:w-48 my-3.5 transition-all transform-gpu" />
|
||||
|
||||
{/* Content */}
|
||||
<OrganizationSelector />
|
||||
|
@ -79,9 +79,11 @@ const UserMenu = (): ReactElement => {
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger>
|
||||
<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">
|
||||
<UserAvatar user={user as User} size="sm" />@
|
||||
{user?.username}
|
||||
<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" />
|
||||
<span className="hidden md:flex">
|
||||
@{user?.username}
|
||||
</span>
|
||||
</div>
|
||||
</SimpleTooltip>
|
||||
</DropdownMenuTrigger>
|
||||
|
Loading…
x
Reference in New Issue
Block a user