DiamondLightSource / DiamondLightSource/sci-react-ui

Change Proposal: Apply `DiamondDSIntegrations` MRT styling automatically to all tables, not just opted-in ones

Ouverte
#280 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
needs-triage
Langage dominant
TypeScript
Étoiles
8
Forks
3
Merge moyen
3 j 15 h
PR mergées (30 j)
5

Description

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par le TODO dans src/themes/DiamondDSIntegrations.ts et examinez comment useMaterialReactTable et MaterialReactTable sont utilisés. Comparez les options proposées du hook ou du wrapper, en conservant l’utilisation de manual mrtOptions()/mrtTheme et en garantissant que les options du caller remplacent les valeurs par défaut de DiamondDS ; le travail est terminé lorsque les tables MRT peuvent recevoir le style de manière cohérente via le nouveau chemin recommandé.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
react, typescript
Domaine
frontend
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
Active
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.