feat: ✨ display menu item tags
parent
c5853f1f55
commit
da835189c5
@ -0,0 +1,34 @@
|
||||
import { Box } from "@styled-system/jsx";
|
||||
import { HoverCard } from "@ark-ui/react";
|
||||
import { IconButton } from "@/components/ui/icon-button";
|
||||
import Image from "next/image";
|
||||
import { ImageIcon } from "lucide-react";
|
||||
import { Media } from "@/payload-types";
|
||||
import { css } from "@styled-system/css";
|
||||
|
||||
export default function MenuItemImage({ image }: { image: Media }) {
|
||||
return (
|
||||
<HoverCard.Root>
|
||||
<HoverCard.Trigger asChild>
|
||||
<IconButton variant="ghost">
|
||||
<ImageIcon />
|
||||
</IconButton>
|
||||
</HoverCard.Trigger>
|
||||
<HoverCard.Positioner>
|
||||
<HoverCard.Content>
|
||||
<HoverCard.Arrow>
|
||||
<HoverCard.ArrowTip />
|
||||
</HoverCard.Arrow>
|
||||
<Box w={250} h={150} position="relative">
|
||||
<Image
|
||||
src={(image as Media).url!}
|
||||
alt={(image as Media).alt ?? ""}
|
||||
className={css({ objectFit: "cover" })}
|
||||
fill
|
||||
/>
|
||||
</Box>
|
||||
</HoverCard.Content>
|
||||
</HoverCard.Positioner>
|
||||
</HoverCard.Root>
|
||||
);
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
import { Box, HStack, Stack } from "@styled-system/jsx";
|
||||
import { Media, MenuItemTag } from "@/payload-types";
|
||||
|
||||
import { HoverCard } from "@/components/ui/hover-card";
|
||||
import { IconButton } from "@/components/ui/icon-button";
|
||||
import Image from "next/image";
|
||||
import { Image as ImageIcon } from "lucide-react";
|
||||
import { Locale } from "@/i18n/settings";
|
||||
import MenuItemImage from "@/app/(frontend)/[locale]/menu/menu-item-image";
|
||||
import RichText from "@/components/rich-text";
|
||||
import { TabContentBaseProps } from "@ark-ui/react";
|
||||
import { Tabs } from "@/components/ui/tabs";
|
||||
import { Text } from "@/components/ui/text";
|
||||
import { css } from "@styled-system/css";
|
||||
import { formatToCHF } from "@/utils/formatters";
|
||||
import { getMenuItems } from "@/api";
|
||||
|
||||
export default function MenuItemTag({ tag }: { tag: MenuItemTag }) {
|
||||
return (
|
||||
<HoverCard.Root>
|
||||
<HoverCard.Trigger asChild>
|
||||
<Box bg="accent.a8" color="white" fontSize="xs" borderRadius="md" p={1}>
|
||||
{(tag as MenuItemTag).name}
|
||||
</Box>
|
||||
</HoverCard.Trigger>
|
||||
<HoverCard.Positioner>
|
||||
<HoverCard.Content p={2} pb={0.5}>
|
||||
<HoverCard.Arrow>
|
||||
<HoverCard.ArrowTip />
|
||||
</HoverCard.Arrow>
|
||||
{(tag as MenuItemTag).description !== undefined && (
|
||||
<RichText
|
||||
content={(tag as MenuItemTag).description}
|
||||
className={css({ fontSize: "sm" })}
|
||||
/>
|
||||
)}
|
||||
</HoverCard.Content>
|
||||
</HoverCard.Positioner>
|
||||
</HoverCard.Root>
|
||||
);
|
||||
}
|
Loading…
Reference in New Issue