Files
sign/apps/remix/app/components/general/app-nav-mobile.tsx

93 lines
2.6 KiB
TypeScript
Raw Normal View History

2025-01-02 15:33:37 +11:00
import { msg } from '@lingui/core/macro';
2024-08-27 20:34:39 +09:00
import { useLingui } from '@lingui/react';
2025-01-02 15:33:37 +11:00
import { Trans } from '@lingui/react/macro';
import { Link, useParams } from 'react-router';
import LogoImage from '@documenso/assets/logo.png';
2025-01-02 15:33:37 +11:00
import { authClient } from '@documenso/auth/client';
import { getRootHref } from '@documenso/lib/utils/params';
import { Sheet, SheetContent } from '@documenso/ui/primitives/sheet';
import { ThemeSwitcher } from '@documenso/ui/primitives/theme-switcher';
2025-01-02 15:33:37 +11:00
export type AppNavMobileProps = {
isMenuOpen: boolean;
onMenuOpenChange?: (_value: boolean) => void;
};
2025-01-02 15:33:37 +11:00
export const AppNavMobile = ({ isMenuOpen, onMenuOpenChange }: AppNavMobileProps) => {
2024-08-27 20:34:39 +09:00
const { _ } = useLingui();
const params = useParams();
const handleMenuItemClick = () => {
onMenuOpenChange?.(false);
};
const rootHref = getRootHref(params, { returnEmptyRootString: true });
const menuNavigationLinks = [
{
href: `${rootHref}/documents`,
2024-08-27 20:34:39 +09:00
text: msg`Documents`,
},
{
href: `${rootHref}/templates`,
2024-08-27 20:34:39 +09:00
text: msg`Templates`,
},
{
href: '/settings/teams',
2024-08-27 20:34:39 +09:00
text: msg`Teams`,
},
{
href: '/settings/profile',
2024-08-27 20:34:39 +09:00
text: msg`Settings`,
},
2024-02-08 12:33:20 +11:00
];
return (
<Sheet open={isMenuOpen} onOpenChange={onMenuOpenChange}>
<SheetContent className="flex w-full max-w-[350px] flex-col">
2025-01-02 15:33:37 +11:00
<Link to="/" onClick={handleMenuItemClick}>
<img
src={LogoImage}
alt="Documenso Logo"
className="dark:invert"
width={170}
height={25}
/>
</Link>
<div className="mt-8 flex w-full flex-col items-start gap-y-4">
{menuNavigationLinks.map(({ href, text }) => (
<Link
key={href}
className="text-foreground hover:text-foreground/80 text-2xl font-semibold"
2025-01-02 15:33:37 +11:00
to={href}
onClick={() => handleMenuItemClick()}
>
2024-08-27 20:34:39 +09:00
{_(text)}
</Link>
))}
<button
className="text-foreground hover:text-foreground/80 text-2xl font-semibold"
2025-01-02 15:33:37 +11:00
onClick={async () => authClient.signOut()}
>
2024-08-27 20:34:39 +09:00
<Trans>Sign Out</Trans>
</button>
</div>
<div className="mt-auto flex w-full flex-col space-y-4 self-end">
<div className="w-fit">
<ThemeSwitcher />
</div>
<p className="text-muted-foreground text-sm">
© {new Date().getFullYear()} Documenso, Inc. <br /> All rights reserved.
</p>
</div>
</SheetContent>
</Sheet>
);
};