Skip to content

Commit

Permalink
prefetch "New Model" link
Browse files Browse the repository at this point in the history
  • Loading branch information
berekuk committed Nov 26, 2024
1 parent 49d8597 commit fa22fa6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/hub/src/components/layout/RootLayout/PageMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const NewModelMenuLink: FC<MenuLinkModeProps> = (props) => {
href={newModelRoute()}
icon={PlusIcon}
title="New Model"
prefetch
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type Props = {
href: string;
icon?: FC<IconProps>;
external?: boolean;
prefetch?: boolean;
} & MenuLinkModeProps;

export const PageMenuLink: FC<Props> = ({
Expand All @@ -30,13 +31,15 @@ export const PageMenuLink: FC<Props> = ({
icon,
href,
external,
prefetch,
}) => {
const Icon = icon;
return mode === "desktop" ? (
<Link
className="select-none rounded-md px-2 py-1 text-sm text-white hover:bg-slate-700"
href={href}
target={external ? "_blank" : undefined}
prefetch={prefetch}
>
{Icon && <Icon className="mr-1 inline-block text-slate-400" size={14} />}
{title}
Expand All @@ -47,6 +50,7 @@ export const PageMenuLink: FC<Props> = ({
icon={icon ?? EmptyIcon}
title={title}
close={close}
prefetch={prefetch}
/>
);
};
4 changes: 3 additions & 1 deletion packages/hub/src/components/ui/DropdownMenuNextLinkItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ type Props = {
title: string;
icon?: FC<IconProps>;
close: () => void;
prefetch?: boolean;
};

export const DropdownMenuNextLinkItem: FC<Props> = ({
title,
href,
icon,
close,
prefetch,
}) => {
return (
<Link href={href} onClick={close}>
<Link href={href} onClick={close} prefetch={prefetch}>
<DropdownMenuItemLayout icon={icon} title={title} />
</Link>
);
Expand Down

0 comments on commit fa22fa6

Please sign in to comment.