1 import clsx from "clsx"
2 import Link from "next/link"
3 import React from "react"
4
5 export type PrerequisiteItemPosition = "top" | "middle" | "bottom" | "alone"
6
7 export type PrerequisiteItemType = {
8 text: string
9 link?: string
10 position?: PrerequisiteItemPosition
11 }
12
13 type PrerequisiteItemProps = {
14 item: PrerequisiteItemType
15 }
16
17 export const PrerequisiteItem = ({
18 item: { text, link, position = "alone" },
19 }: PrerequisiteItemProps) => {
20 return (
21 <Link
22 href={link || "#"}
23 className={clsx(
24 "bg-medusa-tag-neutral-bg text-medusa-fg-subtle",
25 "px-docs_0.75 py-docs_0.5 w-fit",
26 "flex justify-center items-center",
27 link && "hover:bg-medusa-tag-neutral-bg-hover",
28 "rounded-tr-docs_xl rounded-br-docs_xl",
29 position === "alone" && "rounded-docs_xl",
30 position === "top" && "rounded-tl-docs_xl rounded-bl-docs_DEFAULT",
31 position === "middle" &&
32 "rounded-tl-docs_DEFAULT rounded-bl-docs_DEFAULT",
33 position === "bottom" && "rounded-tl-docs_DEFAULT rounded-bl-docs_xl",
34 !link && "cursor-text"
35 )}
36 target={link ? "_blank" : undefined}
37 rel={link ? "noopener noreferrer" : undefined}
38 >
39 {text}
40 {link && "↗"}
41 </Link>
42 )
43 }