Skip to content

Commit 7cbdfda

Browse files
mobile fix for docs nav (#105)
* mobile fix * [autofix.ci] apply automated fixes * new tab no safety --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 175e68f commit 7cbdfda

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

apps/www/components/audit/command.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Command as CommandPrimitive } from "cmdk";
55
import { Search } from "lucide-react";
66
import * as React from "react";
77

8-
import { Dialog, DialogContent } from "@/components/ui/dialog";
8+
import { Dialog, DialogContent, DialogTitle } from "@/components/ui/dialog";
99
import { cn } from "@/lib/utils";
1010

1111
const Command = React.forwardRef<
@@ -31,6 +31,7 @@ const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
3131
return (
3232
<Dialog {...props}>
3333
<DialogContent className="p-0 overflow-hidden shadow-lg">
34+
<DialogTitle className="sr-only">Menu</DialogTitle>
3435
<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-white/60 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
3536
{children as any}
3637
</Command>

apps/www/components/navbar/link.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export const DesktopNavLink: React.FC<Props> = ({ href, label, external }) => {
2323
export function MobileNavLink({
2424
href,
2525
label,
26+
external,
2627
onClick,
2728
}: { href: string; label: string; external?: boolean; onClick: () => void }) {
2829
const segment = useSelectedLayoutSegment();
@@ -39,7 +40,11 @@ export function MobileNavLink({
3940
)}
4041
onClick={() => {
4142
onClick();
42-
router.push(href);
43+
if (external) {
44+
window.open(href, "_blank", "noopener,noreferrer");
45+
} else {
46+
router.push(href);
47+
}
4348
}}
4449
>
4550
{label}

apps/www/components/navbar/navigation.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
DrawerContent,
55
DrawerFooter,
66
DrawerHeader,
7+
DrawerTitle,
78
DrawerTrigger,
89
} from "@/components/ui/drawer";
910
import { cn } from "@/lib/utils";
@@ -109,6 +110,7 @@ function MobileLinks({ className }: { className?: string }) {
109110
</button>
110111
</DrawerTrigger>
111112
<DrawerContent className="bg-black/90 z-[110]">
113+
<DrawerTitle className="sr-only">Menu</DrawerTitle>
112114
<DrawerHeader className="flex justify-center">
113115
<Logo />
114116
</DrawerHeader>
@@ -141,7 +143,12 @@ function MobileLinks({ className }: { className?: string }) {
141143
/>
142144
</li>
143145
<li>
144-
<MobileNavLink onClick={() => setIsOpen(false)} href="/docs" label="Docs" />
146+
<MobileNavLink
147+
onClick={() => setIsOpen(false)}
148+
href="https://unkey.com/docs/introduction"
149+
label="Docs"
150+
external
151+
/>
145152
</li>
146153
<li>
147154
<MobileNavLink
@@ -200,7 +207,7 @@ const DesktopLinks: React.FC<{ className: string }> = ({ className }) => (
200207
<DesktopNavLink href="/templates" label="Templates" />
201208
</li>
202209
<li>
203-
<DesktopNavLink href="/docs/introduction" label="Docs" external />
210+
<DesktopNavLink href="https://unkey.com/docs/introduction" label="Docs" external />
204211
</li>
205212
<li>
206213
<DesktopNavLink href="https://go.unkey.com/discord" label="Discord" external />

apps/www/components/ui/command.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Command as CommandPrimitive } from "cmdk";
55
import { Search } from "lucide-react";
66
import * as React from "react";
77

8-
import { Dialog, DialogContent } from "@/components/ui/dialog";
8+
import { Dialog, DialogContent, DialogTitle } from "@/components/ui/dialog";
99
import { cn } from "@/lib/utils";
1010

1111
const Command = React.forwardRef<
@@ -31,6 +31,7 @@ const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
3131
return (
3232
<Dialog {...props}>
3333
<DialogContent className="overflow-hidden p-0 shadow-lg">
34+
<DialogTitle className="sr-only">Command Menu</DialogTitle>
3435
<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
3536
{children as any}
3637
</Command>

0 commit comments

Comments
 (0)