|
| 1 | +import { defineMessages, useIntl } from "react-intl" |
| 2 | + |
| 3 | +import CheckIcon from "../public/icons/check.svg?inline" |
| 4 | +import ExploringIcon from "../public/icons/exploring.svg?inline" |
| 5 | +import NextIcon from "../public/icons/next-release.svg?inline" |
| 6 | +import WorkingIcon from "../public/icons/working.svg?inline" |
| 7 | +import classNames from "classnames" |
| 8 | + |
| 9 | +interface RoadmapStatusProps { |
| 10 | + status: "exploring" | "working" | "next" | "released" |
| 11 | +} |
| 12 | + |
| 13 | +const messages = defineMessages({ |
| 14 | + exploring: { |
| 15 | + id: "roadmap.status.exploring", |
| 16 | + defaultMessage: "Exploring", |
| 17 | + icon: ExploringIcon, |
| 18 | + }, |
| 19 | + working: { |
| 20 | + id: "roadmap.status.working", |
| 21 | + defaultMessage: "Working", |
| 22 | + icon: WorkingIcon, |
| 23 | + }, |
| 24 | + next: { |
| 25 | + id: "roadmap.status.next", |
| 26 | + defaultMessage: "Next release", |
| 27 | + icon: NextIcon, |
| 28 | + }, |
| 29 | + released: { |
| 30 | + id: "roadmap.status.released", |
| 31 | + defaultMessage: "Released", |
| 32 | + icon: CheckIcon, |
| 33 | + }, |
| 34 | +}) |
| 35 | + |
| 36 | +export function RoadmapStatus({ status }: RoadmapStatusProps) { |
| 37 | + const intl = useIntl() |
| 38 | + const Icon = messages[status].icon |
| 39 | + return ( |
| 40 | + <span |
| 41 | + className={classNames( |
| 42 | + "px-3 py-1 text-b4 inline-flex gap-1 items-center rounded-md whitespace-nowrap", |
| 43 | + { |
| 44 | + "bg-[hsl(234,100%,94%)] text-blurple-600": status === "released", |
| 45 | + "bg-[hsl(141,84%,93%)] text-[hsl(141,100%,19%)]": status === "next", |
| 46 | + "bg-[hsl(48,97%,89%)] text-[hsl(23,91%,25%)]": status === "working", |
| 47 | + "bg-[hsl(0,100%,91%)] text-[hsl(0,100%,25%)]": status === "exploring", |
| 48 | + } |
| 49 | + )} |
| 50 | + > |
| 51 | + {Icon && <Icon className="size-4" />} |
| 52 | + {intl.formatMessage(messages[status])} |
| 53 | + </span> |
| 54 | + ) |
| 55 | +} |
0 commit comments