DiamondLightSource / DiamondLightSource/sci-react-ui
Change Proposal: Apply `DiamondDSIntegrations` MRT styling automatically to all tables, not just opted-in ones
- Ngôn ngữ chính
- TypeScript
- Star
- 8
- Fork
- 3
- Merge trung bình
- 3 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 5
Mô tả
## 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.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với TODO trong src/themes/DiamondDSIntegrations.ts và kiểm tra cách useMaterialReactTable và MaterialReactTable được sử dụng. So sánh các tùy chọn hook hoặc wrapper được đề xuất, giữ nguyên việc sử dụng manual mrtOptions()/mrtTheme và đảm bảo các tùy chọn của caller ghi đè các giá trị mặc định của DiamondDS; hoàn tất khi các bảng MRT có thể nhận kiểu dáng một cách nhất quán thông qua đường dẫn được khuyến nghị mới.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- react, typescript
- Lĩnh vực
- frontend
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100