rad-ui / ui

Rad UI is an open-source, headless UI component library for building modern, fast, performant, accessible React applications
http://rad-ui.com
MIT License
9 stars 11 forks source link

**Refactor to improve maintainability.** #344

Closed kotAPI closed 3 days ago

kotAPI commented 6 days ago
          **Refactor to improve maintainability.**

The ColorsTemplate component and ColorBubble function are statically defining a large number of color classes. Consider refactoring this to use a data-driven approach, where color classes are stored in an array or object and rendered using a map function. This would greatly improve maintainability and reduce the size of the component.

const colorClasses = ['bg-gray-50', 'bg-gray-100', ...]; // Add all color classes

function ColorsTemplate() {
  return (
    <div>
      <div className="p-4 space-y-0.5">
        {colorClasses.map(colorClass => (
          <ColorBubble key={colorClass} colorClass={colorClass} />
        ))}
      </div>
    </div>
  );
}

_Originally posted by @coderabbitai[bot] in https://github.com/rad-ui/ui/pull/339#discussion_r1654463047_