Feature: improve file size input and tables - #286
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughMuiFormikFilesizeField is generalized to support configurable displayUnit/valueUnit conversion instead of a fixed MB/bytes assumption, with corresponding tests. Three MUI table components (MuiTable, MuiTableEditable, MuiTableSortable) gain an optional tableSx prop forwarded to their Table's sx attribute. The package version is bumped. ChangesFile Size Field Unit Conversion
Estimated code review effort: 2 (Simple) | ~12 minutes Table Styling Customization (tableSx prop)
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds configurability for file-size Formik inputs (input/display units with conversion) and enables passing custom sx styling into several MUI table components, supporting more flexible UI composition across the component library.
Changes:
- Add
displayUnit/valueUnitsupport toMuiFormikFilesizeField, including unit label adornment and conversion logic. - Add
tableSxprop to table components to allow custom MUIsxstyling on the<Table />. - Extend Jest coverage for custom unit behavior and update package version to
5.0.41-beta.0.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/components/mui/table/mui-table.js | Adds tableSx prop and merges it into the Table sx (keeping fixed layout by default). |
| src/components/mui/sortable-table/mui-table-sortable.js | Adds tableSx prop and applies it to the Table sx. |
| src/components/mui/editable-table/mui-table-editable.js | Adds tableSx prop and applies it to the Table sx. |
| src/components/mui/formik-inputs/mui-formik-file-size-field.js | Implements configurable display/storage units with conversion and dynamic unit adornment. |
| src/components/mui/tests/mui-formik-file-size-field.test.js | Adds tests for unit conversion and unit label behavior. |
| package.json | Bumps package version to 5.0.41-beta.0. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const UNIT_POWERS = { B: 0, KB: 1, MB: 2 }; | ||
|
|
||
| const MuiFormikFilesizeField = ({ name, label, ...props }) => { | ||
| const unitToBytesFactor = (unit) => 1024 ** UNIT_POWERS[unit]; | ||
|
|
| setCleared(false); | ||
| const bytes = Number(mbValue) * BYTES_PER_MB; | ||
| helpers.setValue(bytes); | ||
| helpers.setValue(Number(displayValue) / conversionFactor); | ||
| }; |
https://app.clickup.com/t/9014802374/86bapy7m1
Summary by CodeRabbit
5.0.41-beta.0.