appbaseio / appbaseio/reactivesearch

refactor: consolidate 12 near-identical SVG icon components into one pattern

Abierto
#2,324 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
4.9k
Forks
478
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

## 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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript, react
Área
frontend
Tipo de issue
Refactorización
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
48/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.