Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
♻️ Share one VoteIcon component between web and landing (#2940)
Luke Vellaa3ea3221586d
diff --git a/apps/landing/src/components/home/hero-demo/desktop-demo.tsx b/apps/landing/src/components/home/hero-demo/desktop-demo.tsxindex 8bb0ee074..22944526d 100644--- a/apps/landing/src/components/home/hero-demo/desktop-demo.tsx+++ b/apps/landing/src/components/home/hero-demo/desktop-demo.tsx@@ -87,21 +87,21 @@ export const DesktopDemo = ({</div><div className="mt-1.5 flex items-center gap-4 text-gray-600 text-sm"><span className="flex items-center gap-1.5">- <VoteIcon vote="yes" className="size-4" />+ <VoteIcon vote="yes" />{t("heroDemoYes", {ns: "home",defaultValue: "Yes",})}</span><span className="flex items-center gap-1.5">- <VoteIcon vote="ifNeedBe" className="size-4" />+ <VoteIcon vote="ifNeedBe" />{t("heroDemoIfNeedBe", {ns: "home",defaultValue: "If need be",})}</span><span className="flex items-center gap-1.5">- <VoteIcon vote="no" className="size-4" />+ <VoteIcon vote="no" />{t("heroDemoNo", {ns: "home",defaultValue: "No",@@ -224,7 +224,7 @@ export const DesktopDemo = ({: "border-gray-50 border-l",)}>- <VoteIcon vote={vote} className="size-4" />+ <VoteIcon vote={vote} /></div>))}</React.Fragment>diff --git a/apps/landing/src/components/home/hero-demo/mobile-demo.tsx b/apps/landing/src/components/home/hero-demo/mobile-demo.tsxindex df905c08e..272bcff1e 100644--- a/apps/landing/src/components/home/hero-demo/mobile-demo.tsx+++ b/apps/landing/src/components/home/hero-demo/mobile-demo.tsx@@ -58,7 +58,6 @@ const TriState = ({<VoteIconvote={vote}className={cn(- "size-3.5",!isSelected &&"text-gray-400 opacity-50 transition-opacity group-hover:opacity-100",)}diff --git a/apps/landing/src/components/home/hero-demo/vote-icon.tsx b/apps/landing/src/components/home/hero-demo/vote-icon.tsxindex dd328176d..cd826fbf5 100644--- a/apps/landing/src/components/home/hero-demo/vote-icon.tsx+++ b/apps/landing/src/components/home/hero-demo/vote-icon.tsx@@ -1,38 +1,10 @@-import { cn } from "@rallly/ui";-import { CheckIcon, XIcon } from "lucide-react";+import { VoteIcon as BaseVoteIcon } from "@rallly/ui/vote-icon";import type { DemoVote } from "./demo-data";-export const IfNeedBeIcon = ({ className }: { className?: string }) => (- <svg- viewBox="0 0 24 24"- fill="none"- stroke="currentColor"- strokeWidth={3.5}- strokeLinecap="round"- aria-hidden="true"- className={className}- >- <path d="M20 13.5c-2.5-5-5-5-7-1s-4.5 4-7-1" />- </svg>-);-export const VoteIcon = ({vote,className,}: {vote: DemoVote;className?: string;-}) => {- if (vote === "yes") {- return (- <CheckIcon- strokeWidth={3.5}- className={cn("text-green-500", className)}- />- );- }- if (vote === "ifNeedBe") {- return <IfNeedBeIcon className={cn("text-amber-400", className)} />;- }- return <XIcon strokeWidth={3.5} className={cn("text-gray-400", className)} />;-};+}) => <BaseVoteIcon type={vote} className={className} />;diff --git a/apps/web/src/features/poll/components/vote-icon.tsx b/apps/web/src/features/poll/components/vote-icon.tsxindex ac95a5d24..e320ff130 100644--- a/apps/web/src/features/poll/components/vote-icon.tsx+++ b/apps/web/src/features/poll/components/vote-icon.tsx@@ -1,22 +1,8 @@-import type { VoteType } from "@rallly/database";-import { cn } from "@rallly/ui";-import type { VariantProps } from "class-variance-authority";-import { cva } from "class-variance-authority";-import { IfNeedBeIcon } from "@/features/poll/components/vote-icon/if-need-be-icon";-import { NoIcon } from "@/features/poll/components/vote-icon/no-icon";-import { PendingIcon } from "@/features/poll/components/vote-icon/pending-icon";-import { YesIcon } from "@/features/poll/components/vote-icon/yes-icon";--const iconVariants = cva("", {- variants: {- size: {- sm: "size-3",- md: "size-5",- },- },-});+"use client";-type IconVariantProps = VariantProps<typeof iconVariants>;+import type { VoteType } from "@rallly/database";+import { VoteIcon as BaseVoteIcon } from "@rallly/ui/vote-icon";+import { useTranslation } from "@/i18n/client";const VoteIcon = ({type,@@ -24,20 +10,27 @@ const VoteIcon = ({className,}: {type?: VoteType;+ size?: "sm" | "md";className?: string;-} & IconVariantProps) => {- const iconClassName = iconVariants({ size });- switch (type) {- case "yes":- return <YesIcon className={cn(iconClassName, className)} />;- case "ifNeedBe":- return <IfNeedBeIcon className={cn(iconClassName, className)} />;- case "no":- return <NoIcon className={cn(iconClassName, className)} />;+}) => {+ const { t } = useTranslation();++ const title = type+ ? {+ yes: t("yes", { defaultValue: "Yes" }),+ ifNeedBe: t("ifNeedBe", { defaultValue: "If need be" }),+ no: t("no", { defaultValue: "No" }),+ }[type]+ : t("pending", { defaultValue: "Pending" });- default:- return <PendingIcon className={cn(iconClassName, className)} />;- }+ return (+ <BaseVoteIcon+ type={type ?? "pending"}+ size={size}+ title={title}+ className={className}+ />+ );};export default VoteIcon;diff --git a/apps/web/src/features/poll/components/vote-icon/if-need-be-icon.tsx b/apps/web/src/features/poll/components/vote-icon/if-need-be-icon.tsxdeleted file mode 100644index a0aa002cc..000000000--- a/apps/web/src/features/poll/components/vote-icon/if-need-be-icon.tsx+++ /dev/null@@ -1,24 +0,0 @@-import { Trans } from "@/i18n/client";--export function IfNeedBeIcon({ className }: { className?: string }) {- return (- <svg- viewBox="0 0 20 20"- fill="none"- xmlns="http://www.w3.org/2000/svg"- className={className}- >- <title>- <Trans i18nKey="ifNeedBe" defaults="If need be" />- </title>- <g transform="translate(10 10) scale(1.5) translate(-10 -10)">- <path- fillRule="evenodd"- clipRule="evenodd"- d="M13.106 10.447C12.796 9.827 12.52 9.433 12.293 9.207C12.116 9.03 12.02 9.004 12 9C11.98 9.004 11.884 9.03 11.707 9.207C11.481 9.433 11.204 9.827 10.895 10.447C10.538 11.161 10.148 11.767 9.707 12.207C9.265 12.65 8.692 13 8 13C7.308 13 6.735 12.65 6.293 12.207C5.853 11.767 5.463 11.161 5.106 10.447C5.04609 10.3294 5.01004 10.2011 4.99995 10.0695C4.98985 9.93793 5.0059 9.80564 5.04718 9.68029C5.08845 9.55493 5.15413 9.43898 5.24043 9.33913C5.32673 9.23928 5.43194 9.1575 5.55 9.0985C5.66806 9.0395 5.79663 9.00446 5.92829 8.99539C6.05996 8.98632 6.19212 9.0034 6.31715 9.04566C6.44218 9.08791 6.55761 9.15449 6.65679 9.24156C6.75597 9.32864 6.83693 9.43449 6.895 9.553C7.205 10.173 7.481 10.566 7.707 10.793C7.884 10.97 7.98 10.997 8 11C8.02 10.996 8.116 10.97 8.293 10.793C8.519 10.567 8.796 10.173 9.106 9.553C9.463 8.839 9.853 8.233 10.293 7.793C10.735 7.35 11.308 7 12 7C12.692 7 13.265 7.35 13.707 7.793C14.147 8.233 14.537 8.839 14.895 9.553C14.9537 9.67053 14.9887 9.79848 14.9979 9.92953C15.0072 10.0606 14.9905 10.1922 14.9489 10.3168C14.9073 10.4414 14.8416 10.5566 14.7555 10.6558C14.6694 10.755 14.5645 10.8363 14.447 10.895C14.3295 10.9537 14.2015 10.9887 14.0705 10.9979C13.9394 11.0072 13.8078 10.9905 13.6832 10.9489C13.5586 10.9073 13.4434 10.8416 13.3442 10.7555C13.245 10.6694 13.1637 10.5645 13.105 10.447H13.106ZM11.996 9H12H11.998H11.996Z"- fill="#FFB900"- />- </g>- </svg>- );-}diff --git a/apps/web/src/features/poll/components/vote-icon/no-icon.tsx b/apps/web/src/features/poll/components/vote-icon/no-icon.tsxdeleted file mode 100644index b0c6ede68..000000000--- a/apps/web/src/features/poll/components/vote-icon/no-icon.tsx+++ /dev/null@@ -1,24 +0,0 @@-import { Trans } from "@/i18n/client";--export function NoIcon({ className }: { className?: string }) {- return (- <svg- viewBox="0 0 20 20"- fill="none"- xmlns="http://www.w3.org/2000/svg"- className={className}- >- <title>- <Trans i18nKey="no" defaults="No" />- </title>- <g transform="translate(10 10) scale(1.5) translate(-10 -10)">- <path- fillRule="evenodd"- clipRule="evenodd"- d="M8.707 7.293C8.5184 7.11084 8.2658 7.01005 8.0036 7.01233C7.7414 7.0146 7.49059 7.11977 7.30518 7.30518C7.11977 7.49059 7.0146 7.7414 7.01233 8.0036C7.01005 8.2658 7.11084 8.5184 7.293 8.707L8.586 10L7.293 11.293C7.19749 11.3852 7.12131 11.4956 7.0689 11.6176C7.01649 11.7396 6.9889 11.8708 6.98775 12.0036C6.9866 12.1364 7.0119 12.2681 7.06218 12.391C7.11246 12.5139 7.18671 12.6255 7.2806 12.7194C7.3745 12.8133 7.48615 12.8875 7.60905 12.9378C7.73194 12.9881 7.86362 13.0134 7.9964 13.0123C8.12918 13.0111 8.2604 12.9835 8.3824 12.9311C8.50441 12.8787 8.61475 12.8025 8.707 12.707L10 11.414L11.293 12.707C11.4816 12.8892 11.7342 12.99 11.9964 12.9877C12.2586 12.9854 12.5094 12.8802 12.6948 12.6948C12.8802 12.5094 12.9854 12.2586 12.9877 11.9964C12.99 11.7342 12.8892 11.4816 12.707 11.293L11.414 10L12.707 8.707C12.8892 8.5184 12.99 8.2658 12.9877 8.0036C12.9854 7.7414 12.8802 7.49059 12.6948 7.30518C12.5094 7.11977 12.2586 7.0146 11.9964 7.01233C11.7342 7.01005 11.4816 7.11084 11.293 7.293L10 8.586L8.707 7.293Z"- fill="#71717b"- />- </g>- </svg>- );-}diff --git a/apps/web/src/features/poll/components/vote-icon/pending-icon.tsx b/apps/web/src/features/poll/components/vote-icon/pending-icon.tsxdeleted file mode 100644index 1656d0399..000000000--- a/apps/web/src/features/poll/components/vote-icon/pending-icon.tsx+++ /dev/null@@ -1,20 +0,0 @@-import { Trans } from "@/i18n/client";--export function PendingIcon({ className }: { className?: string }) {- return (- <svg- viewBox="0 0 16 16"- fill="none"- xmlns="http://www.w3.org/2000/svg"- className={className}- >- <title>- <Trans i18nKey="pending" defaults="Pending" />- </title>- <path- d="M4 5.313C4 4.811 4.163 4.303 4.488 3.791C4.813 3.273 5.288 2.845 5.912 2.507C6.536 2.17 7.264 2 8.096 2C8.869 2 9.552 2.143 10.144 2.428C10.736 2.708 11.192 3.091 11.512 3.578C11.837 4.063 12 4.592 12 5.162C12 5.612 11.907 6.005 11.72 6.343C11.539 6.682 11.32 6.975 11.064 7.223C10.814 7.466 10.36 7.878 9.704 8.46C9.54953 8.59724 9.40265 8.74279 9.264 8.896C9.094 9.08223 8.96821 9.30441 8.896 9.546C8.869 9.646 8.826 9.826 8.768 10.085C8.667 10.635 8.349 10.909 7.816 10.909C7.55494 10.9152 7.30198 10.8182 7.112 10.639C6.925 10.459 6.832 10.193 6.832 9.839C6.832 9.395 6.902 9.012 7.04 8.689C7.179 8.362 7.363 8.077 7.592 7.834C7.822 7.585 8.131 7.292 8.52 6.954C8.861 6.658 9.107 6.436 9.256 6.288C9.40788 6.13849 9.53723 5.96771 9.64 5.781C9.747 5.596 9.8 5.395 9.8 5.178C9.8 4.756 9.64 4.398 9.32 4.108C9.005 3.818 8.597 3.672 8.096 3.672C7.509 3.672 7.077 3.82 6.8 4.116C6.523 4.406 6.288 4.838 6.096 5.408C5.915 6.005 5.571 6.304 5.064 6.304C4.92292 6.30659 4.78278 6.28044 4.65212 6.22715C4.52147 6.17385 4.40302 6.09453 4.304 5.994C4.101 5.785 4 5.557 4 5.315V5.313ZM7.904 14C7.59047 14.0041 7.28618 13.8939 7.048 13.69C6.808 13.48 6.688 13.186 6.688 12.811C6.688 12.478 6.805 12.198 7.04 11.971C7.275 11.744 7.563 11.631 7.904 11.631C8.24 11.631 8.523 11.744 8.752 11.971C8.982 12.198 9.096 12.478 9.096 12.811C9.096 13.181 8.976 13.471 8.736 13.683C8.496 13.894 8.219 14 7.904 14Z"- fill="#D1D5DC"- />- </svg>- );-}diff --git a/apps/web/src/features/poll/components/vote-icon/yes-icon.tsx b/apps/web/src/features/poll/components/vote-icon/yes-icon.tsxdeleted file mode 100644index ae22f0e00..000000000--- a/apps/web/src/features/poll/components/vote-icon/yes-icon.tsx+++ /dev/null@@ -1,24 +0,0 @@-import { Trans } from "@/i18n/client";--export function YesIcon({ className }: { className?: string }) {- return (- <svg- viewBox="0 0 20 20"- fill="none"- xmlns="http://www.w3.org/2000/svg"- className={className}- >- <title>- <Trans i18nKey="yes" defaults="Yes" />- </title>- <g transform="translate(10 10) scale(1.5) translate(-10 -10)">- <path- fillRule="evenodd"- clipRule="evenodd"- d="M13.707 8.707C13.8892 8.5184 13.99 8.2658 13.9877 8.0036C13.9854 7.7414 13.8802 7.49059 13.6948 7.30518C13.5094 7.11977 13.2586 7.0146 12.9964 7.01233C12.7342 7.01005 12.4816 7.11084 12.293 7.293L9 10.586L7.707 9.293C7.5184 9.11084 7.2658 9.01005 7.0036 9.01233C6.7414 9.0146 6.49059 9.11977 6.30518 9.30518C6.11977 9.49059 6.0146 9.7414 6.01233 10.0036C6.01005 10.2658 6.11084 10.5184 6.293 10.707L8.293 12.707C8.48053 12.8945 8.73484 12.9998 9 12.9998C9.26516 12.9998 9.51947 12.8945 9.707 12.707L13.707 8.707Z"- fill="#00C950"- />- </g>- </svg>- );-}diff --git a/apps/web/src/features/poll/components/vote-segmented-control.tsx b/apps/web/src/features/poll/components/vote-segmented-control.tsxindex a6ec9e46e..da4651e2a 100644--- a/apps/web/src/features/poll/components/vote-segmented-control.tsx+++ b/apps/web/src/features/poll/components/vote-segmented-control.tsx@@ -54,7 +54,7 @@ export const VoteSegmentedControl = ({key={type}value={type}aria-label={voteLabels[type]}- className="w-11 data-unchecked:[&_path]:fill-gray-400"+ className="w-11 data-unchecked:[&_svg]:text-gray-400"><VoteIcon type={type} /></SegmentedControlItem>diff --git a/packages/ui/src/vote-icon.tsx b/packages/ui/src/vote-icon.tsxnew file mode 100644index 000000000..611db4fea--- /dev/null+++ b/packages/ui/src/vote-icon.tsx@@ -0,0 +1,88 @@+import { cn } from "@rallly/ui";+import type { VariantProps } from "class-variance-authority";+import { cva } from "class-variance-authority";++export type VoteIconType = "yes" | "ifNeedBe" | "no" | "pending";++const voteIconVariants = cva("", {+ variants: {+ size: {+ sm: "size-3",+ md: "size-5",+ },+ type: {+ yes: "text-green-500",+ ifNeedBe: "text-amber-400",+ no: "text-zinc-500",+ pending: "text-zinc-300",+ },+ },+ defaultVariants: {+ size: "md",+ },+});++type VoteIconProps = {+ type?: VoteIconType;+ /**+ * Accessible label. Omit to render the icon as decorative (aria-hidden),+ * which is correct when adjacent text already names the vote.+ */+ title?: string;+ className?: string;+} & Omit<VariantProps<typeof voteIconVariants>, "type">;++const paths: Record<VoteIconType, { viewBox: string; d: string }> = {+ yes: {+ viewBox: "0 0 20 20",+ d: "M13.707 8.707C13.8892 8.5184 13.99 8.2658 13.9877 8.0036C13.9854 7.7414 13.8802 7.49059 13.6948 7.30518C13.5094 7.11977 13.2586 7.0146 12.9964 7.01233C12.7342 7.01005 12.4816 7.11084 12.293 7.293L9 10.586L7.707 9.293C7.5184 9.11084 7.2658 9.01005 7.0036 9.01233C6.7414 9.0146 6.49059 9.11977 6.30518 9.30518C6.11977 9.49059 6.0146 9.7414 6.01233 10.0036C6.01005 10.2658 6.11084 10.5184 6.293 10.707L8.293 12.707C8.48053 12.8945 8.73484 12.9998 9 12.9998C9.26516 12.9998 9.51947 12.8945 9.707 12.707L13.707 8.707Z",+ },+ ifNeedBe: {+ viewBox: "0 0 20 20",+ d: "M13.106 10.447C12.796 9.827 12.52 9.433 12.293 9.207C12.116 9.03 12.02 9.004 12 9C11.98 9.004 11.884 9.03 11.707 9.207C11.481 9.433 11.204 9.827 10.895 10.447C10.538 11.161 10.148 11.767 9.707 12.207C9.265 12.65 8.692 13 8 13C7.308 13 6.735 12.65 6.293 12.207C5.853 11.767 5.463 11.161 5.106 10.447C5.04609 10.3294 5.01004 10.2011 4.99995 10.0695C4.98985 9.93793 5.0059 9.80564 5.04718 9.68029C5.08845 9.55493 5.15413 9.43898 5.24043 9.33913C5.32673 9.23928 5.43194 9.1575 5.55 9.0985C5.66806 9.0395 5.79663 9.00446 5.92829 8.99539C6.05996 8.98632 6.19212 9.0034 6.31715 9.04566C6.44218 9.08791 6.55761 9.15449 6.65679 9.24156C6.75597 9.32864 6.83693 9.43449 6.895 9.553C7.205 10.173 7.481 10.566 7.707 10.793C7.884 10.97 7.98 10.997 8 11C8.02 10.996 8.116 10.97 8.293 10.793C8.519 10.567 8.796 10.173 9.106 9.553C9.463 8.839 9.853 8.233 10.293 7.793C10.735 7.35 11.308 7 12 7C12.692 7 13.265 7.35 13.707 7.793C14.147 8.233 14.537 8.839 14.895 9.553C14.9537 9.67053 14.9887 9.79848 14.9979 9.92953C15.0072 10.0606 14.9905 10.1922 14.9489 10.3168C14.9073 10.4414 14.8416 10.5566 14.7555 10.6558C14.6694 10.755 14.5645 10.8363 14.447 10.895C14.3295 10.9537 14.2015 10.9887 14.0705 10.9979C13.9394 11.0072 13.8078 10.9905 13.6832 10.9489C13.5586 10.9073 13.4434 10.8416 13.3442 10.7555C13.245 10.6694 13.1637 10.5645 13.105 10.447H13.106ZM11.996 9H12H11.998H11.996Z",+ },+ no: {+ viewBox: "0 0 20 20",+ d: "M8.707 7.293C8.5184 7.11084 8.2658 7.01005 8.0036 7.01233C7.7414 7.0146 7.49059 7.11977 7.30518 7.30518C7.11977 7.49059 7.0146 7.7414 7.01233 8.0036C7.01005 8.2658 7.11084 8.5184 7.293 8.707L8.586 10L7.293 11.293C7.19749 11.3852 7.12131 11.4956 7.0689 11.6176C7.01649 11.7396 6.9889 11.8708 6.98775 12.0036C6.9866 12.1364 7.0119 12.2681 7.06218 12.391C7.11246 12.5139 7.18671 12.6255 7.2806 12.7194C7.3745 12.8133 7.48615 12.8875 7.60905 12.9378C7.73194 12.9881 7.86362 13.0134 7.9964 13.0123C8.12918 13.0111 8.2604 12.9835 8.3824 12.9311C8.50441 12.8787 8.61475 12.8025 8.707 12.707L10 11.414L11.293 12.707C11.4816 12.8892 11.7342 12.99 11.9964 12.9877C12.2586 12.9854 12.5094 12.8802 12.6948 12.6948C12.8802 12.5094 12.9854 12.2586 12.9877 11.9964C12.99 11.7342 12.8892 11.4816 12.707 11.293L11.414 10L12.707 8.707C12.8892 8.5184 12.99 8.2658 12.9877 8.0036C12.9854 7.7414 12.8802 7.49059 12.6948 7.30518C12.5094 7.11977 12.2586 7.0146 11.9964 7.01233C11.7342 7.01005 11.4816 7.11084 11.293 7.293L10 8.586L8.707 7.293Z",+ },+ pending: {+ viewBox: "0 0 16 16",+ d: "M4 5.313C4 4.811 4.163 4.303 4.488 3.791C4.813 3.273 5.288 2.845 5.912 2.507C6.536 2.17 7.264 2 8.096 2C8.869 2 9.552 2.143 10.144 2.428C10.736 2.708 11.192 3.091 11.512 3.578C11.837 4.063 12 4.592 12 5.162C12 5.612 11.907 6.005 11.72 6.343C11.539 6.682 11.32 6.975 11.064 7.223C10.814 7.466 10.36 7.878 9.704 8.46C9.54953 8.59724 9.40265 8.74279 9.264 8.896C9.094 9.08223 8.96821 9.30441 8.896 9.546C8.869 9.646 8.826 9.826 8.768 10.085C8.667 10.635 8.349 10.909 7.816 10.909C7.55494 10.9152 7.30198 10.8182 7.112 10.639C6.925 10.459 6.832 10.193 6.832 9.839C6.832 9.395 6.902 9.012 7.04 8.689C7.179 8.362 7.363 8.077 7.592 7.834C7.822 7.585 8.131 7.292 8.52 6.954C8.861 6.658 9.107 6.436 9.256 6.288C9.40788 6.13849 9.53723 5.96771 9.64 5.781C9.747 5.596 9.8 5.395 9.8 5.178C9.8 4.756 9.64 4.398 9.32 4.108C9.005 3.818 8.597 3.672 8.096 3.672C7.509 3.672 7.077 3.82 6.8 4.116C6.523 4.406 6.288 4.838 6.096 5.408C5.915 6.005 5.571 6.304 5.064 6.304C4.92292 6.30659 4.78278 6.28044 4.65212 6.22715C4.52147 6.17385 4.40302 6.09453 4.304 5.994C4.101 5.785 4 5.557 4 5.315V5.313ZM7.904 14C7.59047 14.0041 7.28618 13.8939 7.048 13.69C6.808 13.48 6.688 13.186 6.688 12.811C6.688 12.478 6.805 12.198 7.04 11.971C7.275 11.744 7.563 11.631 7.904 11.631C8.24 11.631 8.523 11.744 8.752 11.971C8.982 12.198 9.096 12.478 9.096 12.811C9.096 13.181 8.976 13.471 8.736 13.683C8.496 13.894 8.219 14 7.904 14Z",+ },+};++/**+ * The yes/ifNeedBe/no glyphs are drawn small within their 20x20 viewBox, so+ * they are scaled about the centre to match the pending glyph's optical size.+ */+const SCALED_TYPES: VoteIconType[] = ["yes", "ifNeedBe", "no"];++export function VoteIcon({+ type = "pending",+ size,+ title,+ className,+}: VoteIconProps) {+ const { viewBox, d } = paths[type];+ const path = (+ <path fillRule="evenodd" clipRule="evenodd" d={d} fill="currentColor" />+ );++ return (+ <svg+ viewBox={viewBox}+ fill="none"+ xmlns="http://www.w3.org/2000/svg"+ role={title ? "img" : undefined}+ aria-hidden={title ? undefined : true}+ className={cn(voteIconVariants({ size, type }), className)}+ >+ {title ? <title>{title}</title> : null}+ {SCALED_TYPES.includes(type) ? (+ <g transform="translate(10 10) scale(1.5) translate(-10 -10)">{path}</g>+ ) : (+ path+ )}+ </svg>+ );+}