appbaseio / appbaseio/reactivesearch
refactor: consolidate 12 near-identical SVG icon components into one pattern
- Dominant language
- JavaScript
- Stars
- 4.9k
- Forks
- 478
- PR merge metrics
- No merged PRs in 30d
Description
## Problem
The shared components directory has 12 individual SVG components, each with:
- The same styled wrapper import (`@emotion/styled`)
- The same propTypes declaration
- The same React component structure
- Only the SVG `` data differs
Files: `SearchSvg.js`, `CancelSvg.js`, `ThumbsUpSvg.js`, `ThumbsDownSvg.js`, `MicSvg.js`, `MuteSvg.js`, `ListenSvg.js` (523 lines!), `AutofillSvg.js`, `DownloadSvg.js`, `CustomSvg.js`, `Icons.js` (has 4 more icons)
~83% of each file is duplicated boilerplate.
## Suggested Fix
Option A: A single `icons.js` registry mapping icon names to SVG path data, with one shared `Icon` component.
Option B: A sprite-based approach using `` definitions with `` references.
## Severity
Medium — codebase bloat, ~600 lines of duplication
Contributor guide
Research direction
Compare SearchSvg.js, CancelSvg.js, ThumbsUpSvg.js, ThumbsDownSvg.js, MicSvg.js, MuteSvg.js, ListenSvg.js, AutofillSvg.js, DownloadSvg.js, CustomSvg.js, and Icons.js, beginning with their shared wrapper, propTypes, and component structure. Decide between the registry and sprite approaches, then verify that all existing icons remain available without duplicated boilerplate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100