From bf9ee79c9f68197baf404ce96796b3922b2215ba Mon Sep 17 00:00:00 2001 From: adilallo <39313955+adilallo@users.noreply.github.com> Date: Thu, 12 Nov 2026 17:50:45 -0700 Subject: [PATCH] Add diagram and pattern glyphs as currentColor SVG components so a parent text class can recolor them. --- .../asset/DiagramGlyph/DiagramGlyph.tsx | 159 +++++++++++++++++ app/components/asset/DiagramGlyph/advice.svg | 14 ++ .../asset/DiagramGlyph/authority.svg | 11 ++ .../asset/DiagramGlyph/conflict.svg | 11 ++ .../asset/DiagramGlyph/consensus.svg | 16 ++ .../asset/DiagramGlyph/discussion.svg | 13 ++ app/components/asset/DiagramGlyph/group.svg | 11 ++ app/components/asset/DiagramGlyph/index.tsx | 10 ++ app/components/asset/DiagramGlyph/ladder.svg | 11 ++ .../asset/DiagramGlyph/membrane.svg | 8 + app/components/asset/DiagramGlyph/money.svg | 12 ++ app/components/asset/DiagramGlyph/person.svg | 11 ++ app/components/asset/DiagramGlyph/pod.svg | 12 ++ app/components/asset/DiagramGlyph/privacy.svg | 12 ++ app/components/asset/DiagramGlyph/records.svg | 11 ++ .../asset/DiagramGlyph/rotation.svg | 12 ++ .../asset/DiagramGlyph/sortition.svg | 14 ++ app/components/asset/DiagramGlyph/term.svg | 8 + app/components/asset/DiagramGlyph/vote.svg | 7 + .../asset/PatternGlyph/PatternGlyph.tsx | 162 ++++++++++++++++++ .../asset/PatternGlyph/circle-processes.svg | 13 ++ .../asset/PatternGlyph/conflict-council.svg | 12 ++ .../asset/PatternGlyph/consensus-approval.svg | 16 ++ .../asset/PatternGlyph/consensus-building.svg | 10 ++ .../consensus-seeking-with-delegates.svg | 9 + .../PatternGlyph/deliberative-polling.svg | 14 ++ .../PatternGlyph/facilitated-negotiation.svg | 16 ++ .../asset/PatternGlyph/full-consensus.svg | 16 ++ app/components/asset/PatternGlyph/index.tsx | 10 ++ .../asset/PatternGlyph/lazy-consensus.svg | 8 + .../PatternGlyph/membership-agreement.svg | 9 + .../asset/PatternGlyph/modified-consensus.svg | 8 + .../asset/PatternGlyph/open-participation.svg | 5 + .../asset/PatternGlyph/peer-sponsorship.svg | 8 + .../PatternGlyph/provisional-membership.svg | 7 + .../asset/PatternGlyph/screened-referrals.svg | 10 ++ .../asset/PatternGlyph/sociocracy-circles.svg | 10 ++ .../asset/PatternGlyph/tiered-membership.svg | 9 + .../PatternGlyph/training-or-orientation.svg | 10 ++ docs/figma-component-registry.md | 2 + stories/asset/DiagramGlyph.stories.js | 78 +++++++++ stories/asset/PatternGlyph.stories.js | 78 +++++++++ tests/components/DiagramGlyph.test.tsx | 57 ++++++ tests/components/PatternGlyph.test.tsx | 55 ++++++ 44 files changed, 995 insertions(+) create mode 100644 app/components/asset/DiagramGlyph/DiagramGlyph.tsx create mode 100644 app/components/asset/DiagramGlyph/advice.svg create mode 100644 app/components/asset/DiagramGlyph/authority.svg create mode 100644 app/components/asset/DiagramGlyph/conflict.svg create mode 100644 app/components/asset/DiagramGlyph/consensus.svg create mode 100644 app/components/asset/DiagramGlyph/discussion.svg create mode 100644 app/components/asset/DiagramGlyph/group.svg create mode 100644 app/components/asset/DiagramGlyph/index.tsx create mode 100644 app/components/asset/DiagramGlyph/ladder.svg create mode 100644 app/components/asset/DiagramGlyph/membrane.svg create mode 100644 app/components/asset/DiagramGlyph/money.svg create mode 100644 app/components/asset/DiagramGlyph/person.svg create mode 100644 app/components/asset/DiagramGlyph/pod.svg create mode 100644 app/components/asset/DiagramGlyph/privacy.svg create mode 100644 app/components/asset/DiagramGlyph/records.svg create mode 100644 app/components/asset/DiagramGlyph/rotation.svg create mode 100644 app/components/asset/DiagramGlyph/sortition.svg create mode 100644 app/components/asset/DiagramGlyph/term.svg create mode 100644 app/components/asset/DiagramGlyph/vote.svg create mode 100644 app/components/asset/PatternGlyph/PatternGlyph.tsx create mode 100644 app/components/asset/PatternGlyph/circle-processes.svg create mode 100644 app/components/asset/PatternGlyph/conflict-council.svg create mode 100644 app/components/asset/PatternGlyph/consensus-approval.svg create mode 100644 app/components/asset/PatternGlyph/consensus-building.svg create mode 100644 app/components/asset/PatternGlyph/consensus-seeking-with-delegates.svg create mode 100644 app/components/asset/PatternGlyph/deliberative-polling.svg create mode 100644 app/components/asset/PatternGlyph/facilitated-negotiation.svg create mode 100644 app/components/asset/PatternGlyph/full-consensus.svg create mode 100644 app/components/asset/PatternGlyph/index.tsx create mode 100644 app/components/asset/PatternGlyph/lazy-consensus.svg create mode 100644 app/components/asset/PatternGlyph/membership-agreement.svg create mode 100644 app/components/asset/PatternGlyph/modified-consensus.svg create mode 100644 app/components/asset/PatternGlyph/open-participation.svg create mode 100644 app/components/asset/PatternGlyph/peer-sponsorship.svg create mode 100644 app/components/asset/PatternGlyph/provisional-membership.svg create mode 100644 app/components/asset/PatternGlyph/screened-referrals.svg create mode 100644 app/components/asset/PatternGlyph/sociocracy-circles.svg create mode 100644 app/components/asset/PatternGlyph/tiered-membership.svg create mode 100644 app/components/asset/PatternGlyph/training-or-orientation.svg create mode 100644 stories/asset/DiagramGlyph.stories.js create mode 100644 stories/asset/PatternGlyph.stories.js create mode 100644 tests/components/DiagramGlyph.test.tsx create mode 100644 tests/components/PatternGlyph.test.tsx diff --git a/app/components/asset/DiagramGlyph/DiagramGlyph.tsx b/app/components/asset/DiagramGlyph/DiagramGlyph.tsx new file mode 100644 index 0000000..e6f02c7 --- /dev/null +++ b/app/components/asset/DiagramGlyph/DiagramGlyph.tsx @@ -0,0 +1,159 @@ +"use client"; + +/** + * Figma: "Asset / Diagram Glyph" (25359:65776) + */ + +import Image from "next/image"; +import { memo } from "react"; +import AdviceGlyph from "./advice.svg"; +import AuthorityGlyph from "./authority.svg"; +import ConflictGlyph from "./conflict.svg"; +import ConsensusGlyph from "./consensus.svg"; +import DiscussionGlyph from "./discussion.svg"; +import GroupGlyph from "./group.svg"; +import LadderGlyph from "./ladder.svg"; +import MembraneGlyph from "./membrane.svg"; +import MoneyGlyph from "./money.svg"; +import PersonGlyph from "./person.svg"; +import PodGlyph from "./pod.svg"; +import PrivacyGlyph from "./privacy.svg"; +import RecordsGlyph from "./records.svg"; +import RotationGlyph from "./rotation.svg"; +import SortitionGlyph from "./sortition.svg"; +import TermGlyph from "./term.svg"; +import VoteGlyph from "./vote.svg"; + +export const DIAGRAM_GLYPH_OPTIONS = [ + "group", + "pod", + "membrane", + "person", + "authority", + "advice", + "rotation", + "ladder", + "conflict", + "consensus", + "vote", + "sortition", + "term", + "discussion", + "records", + "privacy", + "money", +] as const; + +export type DiagramGlyphName = (typeof DIAGRAM_GLYPH_OPTIONS)[number]; + +export const DIAGRAM_GLYPH_SIZE_OPTIONS = [24, 48] as const; +export type DiagramGlyphSize = (typeof DIAGRAM_GLYPH_SIZE_OPTIONS)[number]; + +type SvgComponent = + | React.ComponentType> + | { default: React.ComponentType> }; + +const glyphMap: Record = { + group: GroupGlyph, + pod: PodGlyph, + membrane: MembraneGlyph, + person: PersonGlyph, + authority: AuthorityGlyph, + advice: AdviceGlyph, + rotation: RotationGlyph, + ladder: LadderGlyph, + conflict: ConflictGlyph, + consensus: ConsensusGlyph, + vote: VoteGlyph, + sortition: SortitionGlyph, + term: TermGlyph, + discussion: DiscussionGlyph, + records: RecordsGlyph, + privacy: PrivacyGlyph, + money: MoneyGlyph, +}; + +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 DiagramGlyphProps { + glyph: DiagramGlyphName; + className?: string; + /** Width and height. Figma grid is 48; diagrams also use 24. */ + size?: DiagramGlyphSize | 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 DiagramGlyphComponent({ + glyph, + className = "", + size = 48, + title, + description, +}: DiagramGlyphProps) { + 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 DiagramGlyph = memo(DiagramGlyphComponent); +DiagramGlyph.displayName = "DiagramGlyph"; + +export default DiagramGlyph; diff --git a/app/components/asset/DiagramGlyph/advice.svg b/app/components/asset/DiagramGlyph/advice.svg new file mode 100644 index 0000000..4a5ea4d --- /dev/null +++ b/app/components/asset/DiagramGlyph/advice.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/app/components/asset/DiagramGlyph/authority.svg b/app/components/asset/DiagramGlyph/authority.svg new file mode 100644 index 0000000..5f4a4df --- /dev/null +++ b/app/components/asset/DiagramGlyph/authority.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/app/components/asset/DiagramGlyph/conflict.svg b/app/components/asset/DiagramGlyph/conflict.svg new file mode 100644 index 0000000..f4f9656 --- /dev/null +++ b/app/components/asset/DiagramGlyph/conflict.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/app/components/asset/DiagramGlyph/consensus.svg b/app/components/asset/DiagramGlyph/consensus.svg new file mode 100644 index 0000000..3f6b7fd --- /dev/null +++ b/app/components/asset/DiagramGlyph/consensus.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/app/components/asset/DiagramGlyph/discussion.svg b/app/components/asset/DiagramGlyph/discussion.svg new file mode 100644 index 0000000..bb81a3a --- /dev/null +++ b/app/components/asset/DiagramGlyph/discussion.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/app/components/asset/DiagramGlyph/group.svg b/app/components/asset/DiagramGlyph/group.svg new file mode 100644 index 0000000..ee69fb3 --- /dev/null +++ b/app/components/asset/DiagramGlyph/group.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/app/components/asset/DiagramGlyph/index.tsx b/app/components/asset/DiagramGlyph/index.tsx new file mode 100644 index 0000000..c2d7b5e --- /dev/null +++ b/app/components/asset/DiagramGlyph/index.tsx @@ -0,0 +1,10 @@ +export { default } from "./DiagramGlyph"; +export { + DIAGRAM_GLYPH_OPTIONS, + DIAGRAM_GLYPH_SIZE_OPTIONS, +} from "./DiagramGlyph"; +export type { + DiagramGlyphName, + DiagramGlyphProps, + DiagramGlyphSize, +} from "./DiagramGlyph"; diff --git a/app/components/asset/DiagramGlyph/ladder.svg b/app/components/asset/DiagramGlyph/ladder.svg new file mode 100644 index 0000000..ccc7ae7 --- /dev/null +++ b/app/components/asset/DiagramGlyph/ladder.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/app/components/asset/DiagramGlyph/membrane.svg b/app/components/asset/DiagramGlyph/membrane.svg new file mode 100644 index 0000000..2a6b1b9 --- /dev/null +++ b/app/components/asset/DiagramGlyph/membrane.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/app/components/asset/DiagramGlyph/money.svg b/app/components/asset/DiagramGlyph/money.svg new file mode 100644 index 0000000..84abdaf --- /dev/null +++ b/app/components/asset/DiagramGlyph/money.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/app/components/asset/DiagramGlyph/person.svg b/app/components/asset/DiagramGlyph/person.svg new file mode 100644 index 0000000..bafb9dc --- /dev/null +++ b/app/components/asset/DiagramGlyph/person.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/app/components/asset/DiagramGlyph/pod.svg b/app/components/asset/DiagramGlyph/pod.svg new file mode 100644 index 0000000..d650384 --- /dev/null +++ b/app/components/asset/DiagramGlyph/pod.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/app/components/asset/DiagramGlyph/privacy.svg b/app/components/asset/DiagramGlyph/privacy.svg new file mode 100644 index 0000000..a199b09 --- /dev/null +++ b/app/components/asset/DiagramGlyph/privacy.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/app/components/asset/DiagramGlyph/records.svg b/app/components/asset/DiagramGlyph/records.svg new file mode 100644 index 0000000..3e06824 --- /dev/null +++ b/app/components/asset/DiagramGlyph/records.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/app/components/asset/DiagramGlyph/rotation.svg b/app/components/asset/DiagramGlyph/rotation.svg new file mode 100644 index 0000000..2684ad1 --- /dev/null +++ b/app/components/asset/DiagramGlyph/rotation.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/app/components/asset/DiagramGlyph/sortition.svg b/app/components/asset/DiagramGlyph/sortition.svg new file mode 100644 index 0000000..a29138f --- /dev/null +++ b/app/components/asset/DiagramGlyph/sortition.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/app/components/asset/DiagramGlyph/term.svg b/app/components/asset/DiagramGlyph/term.svg new file mode 100644 index 0000000..0686e4f --- /dev/null +++ b/app/components/asset/DiagramGlyph/term.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/app/components/asset/DiagramGlyph/vote.svg b/app/components/asset/DiagramGlyph/vote.svg new file mode 100644 index 0000000..97b4705 --- /dev/null +++ b/app/components/asset/DiagramGlyph/vote.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/app/components/asset/PatternGlyph/PatternGlyph.tsx b/app/components/asset/PatternGlyph/PatternGlyph.tsx new file mode 100644 index 0000000..7f3a11b --- /dev/null +++ b/app/components/asset/PatternGlyph/PatternGlyph.tsx @@ -0,0 +1,162 @@ +"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; diff --git a/app/components/asset/PatternGlyph/circle-processes.svg b/app/components/asset/PatternGlyph/circle-processes.svg new file mode 100644 index 0000000..fc02ef4 --- /dev/null +++ b/app/components/asset/PatternGlyph/circle-processes.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/app/components/asset/PatternGlyph/conflict-council.svg b/app/components/asset/PatternGlyph/conflict-council.svg new file mode 100644 index 0000000..0ac6e4a --- /dev/null +++ b/app/components/asset/PatternGlyph/conflict-council.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/app/components/asset/PatternGlyph/consensus-approval.svg b/app/components/asset/PatternGlyph/consensus-approval.svg new file mode 100644 index 0000000..97618d5 --- /dev/null +++ b/app/components/asset/PatternGlyph/consensus-approval.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/app/components/asset/PatternGlyph/consensus-building.svg b/app/components/asset/PatternGlyph/consensus-building.svg new file mode 100644 index 0000000..02489c5 --- /dev/null +++ b/app/components/asset/PatternGlyph/consensus-building.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/app/components/asset/PatternGlyph/consensus-seeking-with-delegates.svg b/app/components/asset/PatternGlyph/consensus-seeking-with-delegates.svg new file mode 100644 index 0000000..4e9da6d --- /dev/null +++ b/app/components/asset/PatternGlyph/consensus-seeking-with-delegates.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/app/components/asset/PatternGlyph/deliberative-polling.svg b/app/components/asset/PatternGlyph/deliberative-polling.svg new file mode 100644 index 0000000..8a0c204 --- /dev/null +++ b/app/components/asset/PatternGlyph/deliberative-polling.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/app/components/asset/PatternGlyph/facilitated-negotiation.svg b/app/components/asset/PatternGlyph/facilitated-negotiation.svg new file mode 100644 index 0000000..8051c37 --- /dev/null +++ b/app/components/asset/PatternGlyph/facilitated-negotiation.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/app/components/asset/PatternGlyph/full-consensus.svg b/app/components/asset/PatternGlyph/full-consensus.svg new file mode 100644 index 0000000..3f6b7fd --- /dev/null +++ b/app/components/asset/PatternGlyph/full-consensus.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/app/components/asset/PatternGlyph/index.tsx b/app/components/asset/PatternGlyph/index.tsx new file mode 100644 index 0000000..3adb70b --- /dev/null +++ b/app/components/asset/PatternGlyph/index.tsx @@ -0,0 +1,10 @@ +export { default } from "./PatternGlyph"; +export { + PATTERN_GLYPH_OPTIONS, + PATTERN_GLYPH_SIZE_OPTIONS, +} from "./PatternGlyph"; +export type { + PatternGlyphName, + PatternGlyphProps, + PatternGlyphSize, +} from "./PatternGlyph"; diff --git a/app/components/asset/PatternGlyph/lazy-consensus.svg b/app/components/asset/PatternGlyph/lazy-consensus.svg new file mode 100644 index 0000000..505a7a2 --- /dev/null +++ b/app/components/asset/PatternGlyph/lazy-consensus.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/app/components/asset/PatternGlyph/membership-agreement.svg b/app/components/asset/PatternGlyph/membership-agreement.svg new file mode 100644 index 0000000..22a6b5a --- /dev/null +++ b/app/components/asset/PatternGlyph/membership-agreement.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/app/components/asset/PatternGlyph/modified-consensus.svg b/app/components/asset/PatternGlyph/modified-consensus.svg new file mode 100644 index 0000000..22817a6 --- /dev/null +++ b/app/components/asset/PatternGlyph/modified-consensus.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/app/components/asset/PatternGlyph/open-participation.svg b/app/components/asset/PatternGlyph/open-participation.svg new file mode 100644 index 0000000..3b0f1b0 --- /dev/null +++ b/app/components/asset/PatternGlyph/open-participation.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/app/components/asset/PatternGlyph/peer-sponsorship.svg b/app/components/asset/PatternGlyph/peer-sponsorship.svg new file mode 100644 index 0000000..94bc04d --- /dev/null +++ b/app/components/asset/PatternGlyph/peer-sponsorship.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/app/components/asset/PatternGlyph/provisional-membership.svg b/app/components/asset/PatternGlyph/provisional-membership.svg new file mode 100644 index 0000000..07be37a --- /dev/null +++ b/app/components/asset/PatternGlyph/provisional-membership.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/app/components/asset/PatternGlyph/screened-referrals.svg b/app/components/asset/PatternGlyph/screened-referrals.svg new file mode 100644 index 0000000..159fc16 --- /dev/null +++ b/app/components/asset/PatternGlyph/screened-referrals.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/app/components/asset/PatternGlyph/sociocracy-circles.svg b/app/components/asset/PatternGlyph/sociocracy-circles.svg new file mode 100644 index 0000000..fe6efb7 --- /dev/null +++ b/app/components/asset/PatternGlyph/sociocracy-circles.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/app/components/asset/PatternGlyph/tiered-membership.svg b/app/components/asset/PatternGlyph/tiered-membership.svg new file mode 100644 index 0000000..04447ab --- /dev/null +++ b/app/components/asset/PatternGlyph/tiered-membership.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/app/components/asset/PatternGlyph/training-or-orientation.svg b/app/components/asset/PatternGlyph/training-or-orientation.svg new file mode 100644 index 0000000..414850a --- /dev/null +++ b/app/components/asset/PatternGlyph/training-or-orientation.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/docs/figma-component-registry.md b/docs/figma-component-registry.md index 748d3d2..dfeb654 100644 --- a/docs/figma-component-registry.md +++ b/docs/figma-component-registry.md @@ -208,6 +208,8 @@ Full folder map and PNG audit: **[guides/static-assets.md](./guides/static-asset - **Imports:** use **`asset/icon`** (named **`Icon`** component), **`asset/Logo`**, **`asset/Avatar`**, etc.—same rule as **`buttons/Button`**, no top-level **`asset/index.tsx`** barrel. - **`asset/icon/`** — **`Icon.tsx`** maps icon names to SVG modules beside it (`arrow_back.svg`, …); **`index.tsx`** re-exports **`Icon`** and **`ICON_NAME_OPTIONS`** / types. +- **`asset/DiagramGlyph/`** — Figma [**Asset / Diagram Glyph**](https://www.figma.com/design/agv0VBLiBlcnSAaiAORgPR/Community-Rule-System?node-id=25359-65776) (25359:65776). 17 inline SVGs on a 48 viewBox; paths use `currentColor`. +- **`asset/PatternGlyph/`** — Figma [**Asset / Pattern Glyph**](https://www.figma.com/design/agv0VBLiBlcnSAaiAORgPR/Community-Rule-System?node-id=25449-199) (25449:199). 18 zine pattern marks; same `currentColor` contract. - **`public/assets/`** — lowercase kebab-case folders: **`icons/`**, **`logos/`** (incl. **`logos/partners/`**), **`marketing/`**, **`case-study/`**, **`shapes/`**, **`vector/`**, **`template-mark/`**, **`share/`**. Use helpers in **`lib/assetUtils.ts`** (`ASSETS`, `partnerLogoPath`, `vectorMarkPath`, …). - **`public/assets/vector/.svg`** — Figma Asset / Vector marks (same kebab **`slug`** convention as **`public/assets/template-mark/`**). Use **`vectorMarkPath(slug)`**. - **`asset/Logo`** — Community Rule **`Logo`** component (folder PascalCase, like **`Avatar/`**); brand SVG at **`public/assets/logos/community-rule.svg`**. diff --git a/stories/asset/DiagramGlyph.stories.js b/stories/asset/DiagramGlyph.stories.js new file mode 100644 index 0000000..acb92f5 --- /dev/null +++ b/stories/asset/DiagramGlyph.stories.js @@ -0,0 +1,78 @@ +import DiagramGlyph, { + DIAGRAM_GLYPH_OPTIONS, + DIAGRAM_GLYPH_SIZE_OPTIONS, +} from "../../app/components/asset/DiagramGlyph"; + +export default { + title: "Components/Asset/DiagramGlyph", + component: DiagramGlyph, + parameters: { + layout: "centered", + docs: { + description: { + component: + "Diagram glyphs from Asset / Diagram Glyph. Paths use currentColor so a parent text class recolors the mark.", + }, + }, + }, + argTypes: { + glyph: { + control: { type: "select" }, + options: [...DIAGRAM_GLYPH_OPTIONS], + }, + size: { + control: { type: "select" }, + options: [...DIAGRAM_GLYPH_SIZE_OPTIONS], + }, + className: { control: "text" }, + title: { control: "text" }, + description: { control: "text" }, + }, +}; + +export const Default = { + args: { + glyph: "group", + size: 48, + className: "text-[var(--color-content-default-primary)]", + }, +}; + +export const Size24 = { + args: { + glyph: "vote", + size: 24, + className: "text-[var(--color-content-default-primary)]", + }, +}; + +export const Recolor = { + args: { + glyph: "consensus", + size: 48, + className: "text-[var(--color-content-default-brand-primary)]", + }, +}; + +export const InDiagram = { + args: { + glyph: "rotation", + size: 48, + className: "text-[var(--color-content-default-primary)]", + title: "Rotation", + description: "Roles move on a set schedule so no one keeps the keys.", + }, +}; + +export const AllGlyphs = { + render: () => ( +
+ {DIAGRAM_GLYPH_OPTIONS.map((glyph) => ( +
+ + {glyph} +
+ ))} +
+ ), +}; diff --git a/stories/asset/PatternGlyph.stories.js b/stories/asset/PatternGlyph.stories.js new file mode 100644 index 0000000..a2f5d7b --- /dev/null +++ b/stories/asset/PatternGlyph.stories.js @@ -0,0 +1,78 @@ +import PatternGlyph, { + PATTERN_GLYPH_OPTIONS, + PATTERN_GLYPH_SIZE_OPTIONS, +} from "../../app/components/asset/PatternGlyph"; + +export default { + title: "Components/Asset/PatternGlyph", + component: PatternGlyph, + parameters: { + layout: "centered", + docs: { + description: { + component: + "Pattern glyphs from the Structure Before Crisis zine. Paths use currentColor so a parent text class recolors the mark.", + }, + }, + }, + argTypes: { + glyph: { + control: { type: "select" }, + options: [...PATTERN_GLYPH_OPTIONS], + }, + size: { + control: { type: "select" }, + options: [...PATTERN_GLYPH_SIZE_OPTIONS], + }, + className: { control: "text" }, + title: { control: "text" }, + description: { control: "text" }, + }, +}; + +export const Default = { + args: { + glyph: "lazy-consensus", + size: 48, + className: "text-[var(--color-content-default-primary)]", + }, +}; + +export const Size24 = { + args: { + glyph: "open-participation", + size: 24, + className: "text-[var(--color-content-default-primary)]", + }, +}; + +export const Recolor = { + args: { + glyph: "full-consensus", + size: 48, + className: "text-[var(--color-content-default-brand-primary)]", + }, +}; + +export const InDiagram = { + args: { + glyph: "conflict-council", + size: 48, + className: "text-[var(--color-content-default-primary)]", + title: "Conflict council", + description: "Named members hear what the first steps could not settle.", + }, +}; + +export const AllGlyphs = { + render: () => ( +
+ {PATTERN_GLYPH_OPTIONS.map((glyph) => ( +
+ + {glyph} +
+ ))} +
+ ), +}; diff --git a/tests/components/DiagramGlyph.test.tsx b/tests/components/DiagramGlyph.test.tsx new file mode 100644 index 0000000..fb886b2 --- /dev/null +++ b/tests/components/DiagramGlyph.test.tsx @@ -0,0 +1,57 @@ +import "@testing-library/jest-dom/vitest"; +import { describe, expect, it } from "vitest"; +import { render, screen } from "@testing-library/react"; +import DiagramGlyph, { + DIAGRAM_GLYPH_OPTIONS, +} from "../../app/components/asset/DiagramGlyph"; + +describe("DiagramGlyph", () => { + it("renders every glyph at 48 and 24", () => { + const { rerender } = render( + , + ); + expect(document.querySelector("svg")).toHaveAttribute("width", "48"); + expect(document.querySelector("svg")).toHaveAttribute("height", "48"); + expect(document.querySelector("svg")).toHaveAttribute("aria-hidden"); + + rerender(); + expect(document.querySelector("svg")).toHaveAttribute("width", "24"); + expect(document.querySelector("svg")).toHaveAttribute("height", "24"); + + for (const glyph of DIAGRAM_GLYPH_OPTIONS) { + rerender(); + expect(document.querySelector("svg")).toBeInTheDocument(); + } + }); + + it("names a diagram glyph and keeps a decorative glyph unlabeled", () => { + const { rerender } = render( + , + ); + expect( + screen.getByRole("img", { + name: "Rotation. Roles move on a set schedule.", + }), + ).toBeInTheDocument(); + + rerender(); + expect(screen.queryByRole("img")).not.toBeInTheDocument(); + expect(document.querySelector("svg")).toHaveAttribute("aria-hidden"); + }); + + it("recolors with one text class", () => { + render( + , + ); + expect(document.querySelector("svg")).toHaveClass( + "text-[var(--color-content-default-brand-primary)]", + ); + }); +}); diff --git a/tests/components/PatternGlyph.test.tsx b/tests/components/PatternGlyph.test.tsx new file mode 100644 index 0000000..9c39a6b --- /dev/null +++ b/tests/components/PatternGlyph.test.tsx @@ -0,0 +1,55 @@ +import "@testing-library/jest-dom/vitest"; +import { describe, expect, it } from "vitest"; +import { render, screen } from "@testing-library/react"; +import PatternGlyph, { + PATTERN_GLYPH_OPTIONS, +} from "../../app/components/asset/PatternGlyph"; + +describe("PatternGlyph", () => { + it("renders every glyph at 48 and 24", () => { + const { rerender } = render( + , + ); + expect(document.querySelector("svg")).toHaveAttribute("width", "48"); + expect(document.querySelector("svg")).toHaveAttribute("aria-hidden"); + + rerender(); + expect(document.querySelector("svg")).toHaveAttribute("width", "24"); + + for (const glyph of PATTERN_GLYPH_OPTIONS) { + rerender(); + expect(document.querySelector("svg")).toBeInTheDocument(); + } + }); + + it("names a diagram glyph and keeps a decorative glyph unlabeled", () => { + const { rerender } = render( + , + ); + expect( + screen.getByRole("img", { + name: "Conflict council. Named members hear what the first steps could not settle.", + }), + ).toBeInTheDocument(); + + rerender(); + expect(screen.queryByRole("img")).not.toBeInTheDocument(); + expect(document.querySelector("svg")).toHaveAttribute("aria-hidden"); + }); + + it("recolors with one text class", () => { + render( + , + ); + expect(document.querySelector("svg")).toHaveClass( + "text-[var(--color-content-default-brand-primary)]", + ); + }); +});