"use client"; /** * Figma: "Asset / Pattern Glyph" (25449:199) */ import Image from "next/image"; import { memo } from "react"; import CircleProcessesGlyph from "./circle-processes.svg"; import ConflictCouncilGlyph from "./conflict-council.svg"; import ConsensusApprovalGlyph from "./consensus-approval.svg"; import ConsensusBuildingGlyph from "./consensus-building.svg"; import ConsensusSeekingWithDelegatesGlyph from "./consensus-seeking-with-delegates.svg"; import DeliberativePollingGlyph from "./deliberative-polling.svg"; import FacilitatedNegotiationGlyph from "./facilitated-negotiation.svg"; import FullConsensusGlyph from "./full-consensus.svg"; import LazyConsensusGlyph from "./lazy-consensus.svg"; import MembershipAgreementGlyph from "./membership-agreement.svg"; import ModifiedConsensusGlyph from "./modified-consensus.svg"; import OpenParticipationGlyph from "./open-participation.svg"; import PeerSponsorshipGlyph from "./peer-sponsorship.svg"; import ProvisionalMembershipGlyph from "./provisional-membership.svg"; import ScreenedReferralsGlyph from "./screened-referrals.svg"; import SociocracyCirclesGlyph from "./sociocracy-circles.svg"; import TieredMembershipGlyph from "./tiered-membership.svg"; import TrainingOrOrientationGlyph from "./training-or-orientation.svg"; export const PATTERN_GLYPH_OPTIONS = [ "lazy-consensus", "full-consensus", "consensus-seeking-with-delegates", "modified-consensus", "sociocracy-circles", "deliberative-polling", "open-participation", "peer-sponsorship", "consensus-approval", "provisional-membership", "membership-agreement", "training-or-orientation", "screened-referrals", "tiered-membership", "consensus-building", "facilitated-negotiation", "conflict-council", "circle-processes", ] as const; export type PatternGlyphName = (typeof PATTERN_GLYPH_OPTIONS)[number]; export const PATTERN_GLYPH_SIZE_OPTIONS = [24, 48] as const; export type PatternGlyphSize = (typeof PATTERN_GLYPH_SIZE_OPTIONS)[number]; type SvgComponent = | React.ComponentType> | { default: React.ComponentType> }; const glyphMap: Record = { "lazy-consensus": LazyConsensusGlyph, "full-consensus": FullConsensusGlyph, "consensus-seeking-with-delegates": ConsensusSeekingWithDelegatesGlyph, "modified-consensus": ModifiedConsensusGlyph, "sociocracy-circles": SociocracyCirclesGlyph, "deliberative-polling": DeliberativePollingGlyph, "open-participation": OpenParticipationGlyph, "peer-sponsorship": PeerSponsorshipGlyph, "consensus-approval": ConsensusApprovalGlyph, "provisional-membership": ProvisionalMembershipGlyph, "membership-agreement": MembershipAgreementGlyph, "training-or-orientation": TrainingOrOrientationGlyph, "screened-referrals": ScreenedReferralsGlyph, "tiered-membership": TieredMembershipGlyph, "consensus-building": ConsensusBuildingGlyph, "facilitated-negotiation": FacilitatedNegotiationGlyph, "conflict-council": ConflictCouncilGlyph, "circle-processes": CircleProcessesGlyph, }; function resolveSvgComponent(module: SvgComponent) { if (typeof module === "object" && module !== null && "default" in module) { return ( module as { default: React.ComponentType>; } ).default; } return module as React.ComponentType>; } export interface PatternGlyphProps { glyph: PatternGlyphName; className?: string; /** Width and height. Figma grid is 48; diagrams also use 24. */ size?: PatternGlyphSize | number; /** * Accessible name when the glyph sits in a diagram. Omit for a decorative * mark (empty alt / `aria-hidden`). */ title?: string; /** Follows `title` when the glyph is named in a diagram. */ description?: string; } function PatternGlyphComponent({ glyph, className = "", size = 48, title, description, }: PatternGlyphProps) { const SvgModule = glyphMap[glyph]; if (!SvgModule) return null; const resolved = resolveSvgComponent(SvgModule); const decorative = !title; const label = [title, description].filter(Boolean).join(". "); if (typeof resolved === "string") { return ( {decorative ); } if (resolved == null) return null; const Svg = resolved as React.ComponentType>; if (decorative) { return ( ); } return ( ); } const PatternGlyph = memo(PatternGlyphComponent); PatternGlyph.displayName = "PatternGlyph"; export default PatternGlyph;