refactor: decouple icon rendering from hardcoded component imports#7897
Closed
jeffa-block wants to merge 1 commit into
Closed
refactor: decouple icon rendering from hardcoded component imports#7897jeffa-block wants to merge 1 commit into
jeffa-block wants to merge 1 commit into
Conversation
67cbba2 to
b4529f8
Compare
FlyingBird, GooseLogo, and WelcomeGooseLogo all hardcode their icon imports directly (Bird1-Bird6, Goose). This extracts icon resolution behind a React context so consumers read from a single provider instead of scattering identical imports across the tree. New files: - packs/types.ts: icon pack interface (static glyph + animation frames) - packs/goose.ts: wraps existing Goose + Bird1-6 (no changes to originals) - packs/registry.ts: pack lookup by id - contexts/GlyphContext.tsx: React context + useGlyphPack hook Refactored consumers: - FlyingBird: reads animation frames from context - GooseLogo: renders via context instead of direct Goose import - WelcomeGooseLogo: same - App: wraps tree with provider
b4529f8 to
2ac4b71
Compare
Contributor
|
This pull request has been automatically marked as stale because it has not had recent activity for 23 days. What happens next?
Thank you for your contribution! 🚀 |
Collaborator
|
Hey @jeffa-block 👋 Closing this draft as part of some housekeeping on stale PRs. Feel free to reopen anytime if you pick this back up! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FlyingBird,GooseLogo, andWelcomeGooseLogoall hardcode their icon imports directly (Bird1–Bird6,Goose). This makes the rendering pipeline rigid — every consumer independently imports and manages the same set of icon components.This PR extracts icon resolution behind a React context so consumers read from a single source of truth instead of scattering identical imports across the tree.
Changes
New files:
packs/types.ts— interface for an icon pack (static glyph + optional animation frames)packs/goose.ts— wraps existingGoose+Bird1–Bird6components (no changes to originals)packs/registry.ts— pack lookup by idcontexts/GlyphContext.tsx— React context +useGlyphPack()hookRefactored consumers:
FlyingBird— reads animation frames from context instead of hardcodedBird1–Bird6importsGooseLogo— renders via context instead of directGooseimportWelcomeGooseLogo— sameApp.tsx— wraps tree with providerWhat this is not
Checklist