DiamondLightSource / DiamondLightSource/sci-react-ui
Change Proposal: Apply `DiamondDSIntegrations` MRT styling automatically to all tables, not just opted-in ones
- Lenguaje dominante
- TypeScript
- Estrellas
- 8
- Forks
- 3
- Merge medio
- 3 d 15 h
- PR fusionados (30 d)
- 5
Descripción
## What is being proposed?
A wrapper or a component that pre-merges `DiamondDSIntegrations.mrtTheme` / `mrtOptions()` so every Material React Table instance in a consuming app picks up DiamondDS styling by default, instead of requiring each call site to use it individually.
## Why is this needed?
#249 added `DiamondDSIntegrations.mrtTheme` / `mrtOptions()`, but they only apply if a developer remembers to use them into a given `useMaterialReactTable` call. If they don't, the table silently falls back to MRT's unstyled defaults, with no error or warning, so styling drifts table-by-table across an app instead of being guaranteed by the design system. This was flagged as a follow-up TODO directly in `src/themes/DiamondDSIntegrations.ts`.
## What will change?
- **Behaviour:** DiamondDS table styling becomes the default for MRT tables rather than opt-in per instance.
- **Component props or usage:** likely a new hook/wrapper is introduced; existing manual `mrtOptions()`/`mrtTheme` spreading should keep working for anyone not yet migrated.
- **New component:** possibly a thin wrapper around `useMaterialReactTable` or `MaterialReactTable`.
## Interface changes (if any)
```ts
// wraps useMaterialReactTable and merges DiamondDS defaults automatically
const table = useDiamondMaterialReactTable({
columns,
data,
// any options here still override the DiamondDS defaults
});
```
## Breaking change?
- [ ] Yes
- [x] No
Additive: existing code that manually uses `mrtOptions()`/`mrtTheme` continues to work; the new hook/wrapper is the recommended path going forward.
Guía de contribución
Línea de trabajo
Comienza con el TODO en src/themes/DiamondDSIntegrations.ts e inspecciona cómo se usan useMaterialReactTable y MaterialReactTable. Compara las opciones propuestas del hook o wrapper, conservando el uso de manual mrtOptions()/mrtTheme y asegurando que las opciones del caller sobrescriban los valores predeterminados de DiamondDS; se considera terminado cuando las tablas MRT puedan recibir el estilo de forma coherente mediante la nueva ruta recomendada.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- react, typescript
- Área
- frontend
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Activo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100