-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Waitp 1231 base matrix component #4707
Waitp 1231 base matrix component #4707
Conversation
|
||
const MatrixTable = styled.table` | ||
border-collapse: collapse; | ||
border: 1px solid ${({ theme }) => hexToRgba(theme.palette.text.primary, 0.2)}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm keen to remove the hexToRgba
function in favour of just using hex colors with opacity. So for example we should just be able to do ${theme.palette.text.primary}33
to get the same result, right?.
https://www.w3schools.com/cssref/css_colors_legal.php
value={{ | ||
presentationOptions, | ||
columns, | ||
rows, | ||
startColumn, | ||
maxColumns, | ||
expandedRows, | ||
enlargedCell, | ||
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think there is any need to wrap this context value in a useMemo to optimise performance?
${({ theme }) => | ||
theme.palette.background.default === 'transparent' | ||
? 'transparent' | ||
: hexToRgba(theme.palette.background.default, 0.8)}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
: hexToRgba(theme.palette.background.default, 0.8)}; | |
: `${theme.palette.background.default}cc`; |
const updateMaxColumns = () => { | ||
if (!tableEl || !tableEl?.current || !tableEl?.current?.offsetWidth) return; | ||
const { offsetWidth } = tableEl?.current; | ||
// 200px is the max width of a column that we want to show |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice comment
|
||
type RowTitle = MatrixRowType['title']; | ||
|
||
const defaultContextValue = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really nice. I think that useReducer and context are a great choice here and it organises all these fiddly interactions really nicely.
*/ | ||
|
||
export { Matrix } from './Matrix'; | ||
export * from './utils'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do the utils need to be exported? I can't see them used anywhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mainly did this in case of using them in tupaia-web
but I can remove until that comes up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks so good. Nice work handling all that complexity. I just have one requested change about removing the rgb util
…ssential/tupaia into waitp-1231-base-matrix-component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
* Working legend, grouped columns * Apply location values * Tidy up * Styled column groups * Tiy up files * Add in hidden column titles * Update hidden column title and config types * Generate types * Move the buttons * WAITP-1222: Marker layer (#4686) * setup map entites * wip * wip * re organise project view * mobile search layout * polygon layer * map animation * fix mini map * Update Dashboard.tsx * merging * map overlay data * add Map overlays feature folder * useEntitiesWithLocation * typescript * remove test code * Update InteractivePolygon.tsx * set up * fix api * marker layer * Update types.d.ts * update map layout * wip map overlays * revert map control layout * Update useEntities.ts * copy lesmis * wip * Update MapOverlayList.tsx * default map overlay * radius overlays * navigate to dashboard * fix scroll * measure level * refactor marker layer * refactor useDefaultMapOverlay * types * useEntitiesByMeasureLevel * Update MapOverlaysRoute.ts * fix active entity * Update MarkerLayer.tsx * add comments * Update processMeasureData.ts * refactor useDefaultMapOverlay * Fix merge conflicts * Fix conflict errors --------- Co-authored-by: Tom Caiger <caigertom@gmail.com>
* WAITP-1231 Working table * WIP * Update Matrix.tsx * Fix linting errors * convert to use context * Update hooks * Fix issues * Reorganise files * reorganise context * Working table * Remove enlarged cell modal file * Working modal * Tidy up * Update MatrixCell.tsx * Tidy up hover * Add cell handling for markdown * fix types * WAITP-1231 fixes * Delete types.d.ts * Update index.ts * Fix type error * Waitp 1231 base matrix part 2 (#4714) * Working legend, grouped columns * Apply location values * Tidy up * Styled column groups * Tiy up files * Add in hidden column titles * Update hidden column title and config types * Generate types * Move the buttons * WAITP-1222: Marker layer (#4686) * setup map entites * wip * wip * re organise project view * mobile search layout * polygon layer * map animation * fix mini map * Update Dashboard.tsx * merging * map overlay data * add Map overlays feature folder * useEntitiesWithLocation * typescript * remove test code * Update InteractivePolygon.tsx * set up * fix api * marker layer * Update types.d.ts * update map layout * wip map overlays * revert map control layout * Update useEntities.ts * copy lesmis * wip * Update MapOverlayList.tsx * default map overlay * radius overlays * navigate to dashboard * fix scroll * measure level * refactor marker layer * refactor useDefaultMapOverlay * types * useEntitiesByMeasureLevel * Update MapOverlaysRoute.ts * fix active entity * Update MarkerLayer.tsx * add comments * Update processMeasureData.ts * refactor useDefaultMapOverlay * Fix merge conflicts * Fix conflict errors --------- Co-authored-by: Tom Caiger <caigertom@gmail.com> --------- Co-authored-by: Tom Caiger <caigertom@gmail.com>
* WAITP-1231 Working table * WIP * Update Matrix.tsx * Fix linting errors * convert to use context * Update hooks * Fix issues * Reorganise files * reorganise context * Working table * Remove enlarged cell modal file * Working modal * Tidy up * Update MatrixCell.tsx * Tidy up hover * Add cell handling for markdown * fix types * WAITP-1231 fixes * Delete types.d.ts * Update index.ts * Fix type error * Waitp 1231 base matrix part 2 (#4714) * Working legend, grouped columns * Apply location values * Tidy up * Styled column groups * Tiy up files * Add in hidden column titles * Update hidden column title and config types * Generate types * Move the buttons * WAITP-1222: Marker layer (#4686) * setup map entites * wip * wip * re organise project view * mobile search layout * polygon layer * map animation * fix mini map * Update Dashboard.tsx * merging * map overlay data * add Map overlays feature folder * useEntitiesWithLocation * typescript * remove test code * Update InteractivePolygon.tsx * set up * fix api * marker layer * Update types.d.ts * update map layout * wip map overlays * revert map control layout * Update useEntities.ts * copy lesmis * wip * Update MapOverlayList.tsx * default map overlay * radius overlays * navigate to dashboard * fix scroll * measure level * refactor marker layer * refactor useDefaultMapOverlay * types * useEntitiesByMeasureLevel * Update MapOverlaysRoute.ts * fix active entity * Update MarkerLayer.tsx * add comments * Update processMeasureData.ts * refactor useDefaultMapOverlay * Fix merge conflicts * Fix conflict errors --------- Co-authored-by: Tom Caiger <caigertom@gmail.com> --------- Co-authored-by: Tom Caiger <caigertom@gmail.com>
Issue WAITP-1231: Base UI component for matrix table
Changes:
ui-components
types
packageNote: column groups are not implemented as yet, that will be in a separate PR
Screenshots:
Basic matrix
Nested with dots
Nested with basic data
Modal with data, shown on click of cell