1 import { ReactNode } from "react"
2 import { Link } from "react-router-dom"
3
4 import { TriangleRightMini } from "@medusajs/icons"
5 import { Text } from "@medusajs/ui"
6 import { IconAvatar } from "../icon-avatar"
7
8 export interface SidebarLinkProps {
9 to: string
10 labelKey: string
11 descriptionKey: string
12 icon: ReactNode
13 }
14
15 export const SidebarLink = ({
16 to,
17 labelKey,
18 descriptionKey,
19 icon,
20 }: SidebarLinkProps) => {
21 return (
22 <Link to={to} className="group outline-none">
23 <div className="flex flex-col gap-2 px-2 pb-2">
24 <div className="shadow-elevation-card-rest bg-ui-bg-component transition-fg hover:bg-ui-bg-component-hover active:bg-ui-bg-component-pressed group-focus-visible:shadow-borders-interactive-with-active rounded-md px-4 py-2">
25 <div className="flex items-center gap-4">
26 <IconAvatar>{icon}</IconAvatar>
27 <div className="flex flex-1 flex-col">
28 <Text size="small" leading="compact" weight="plus">
29 {labelKey}
30 </Text>
31 <Text
32 size="small"
33 leading="compact"
34 className="text-ui-fg-subtle"
35 >
36 {descriptionKey}
37 </Text>
38 </div>
39 <div className="flex size-7 items-center justify-center">
40 <TriangleRightMini className="text-ui-fg-muted rtl:rotate-180" />
41 </div>
42 </div>
43 </div>
44 </div>
45 </Link>
46 )
47 }