-
Notifications
You must be signed in to change notification settings - Fork 0
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
✨ #11 - feat: add datagrid component #18
Conversation
c9d9338
to
4b385e6
Compare
bfff84e
to
e64b0b6
Compare
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 have done some code checks, visually:
- We are missing checkboxes to select each datagrid, and the button to do something with the selected ones. Are we leaving this aside for now?
- The table headers are not aligned correctly according to the design.
- Could you take another look at the mobile design, the aligning of the values seems a bit unnatural to me.
- Upon closer inspection, the borders on the pagination buttons are always lit up (blueish), but in the design they should be more greyed out. Any thoughts on this?
&__row { | ||
background-color: var( | ||
--typography-color-background | ||
); //border-radius: var(--border-radus-m); |
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.
Can we remove this comment?
src/components/datagrid/datagrid.tsx
Outdated
*/ | ||
const renderCell = (rowData: RowData, field: string, index: number) => { | ||
const fieldIndex = renderableFields.indexOf(field); | ||
const urlField = urlFields.find((f) => String(rowData[f]).match(REGEX_URL)); |
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.
Is it possible to make a re-usable function in libs for this?
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 moved field2caption to libs, extracting the urlField seems to be very specific logic to me. I don't think we should move that to libs for now.
Update: isLink created in libs
: isImplicitLink | ||
? String(rowUrl) | ||
: ""; | ||
|
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 understand why we are using the ternaries here, but it is very unreadable. Could we slightly refactor this for readability?
/** | ||
* FIXME: This effectively still uses index as keys which might lead to issues. | ||
* @see {@link https://react.dev/learn/rendering-lists#rules-of-keys|Rules of keys} | ||
*/ |
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.
Could we apply the FIXME? 😄
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.
Will do so in a future PR containing the sorting functionality.
src/components/datagrid/datagrid.tsx
Outdated
* Converts "field_name" to "FIELD NAME". | ||
* @param field | ||
*/ | ||
const field2Caption = (field: string): string => |
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.
Should we make a function in lib for this?
Yes, they might be added in the future but we postponed that feature for now.
|
789c488
to
f0bd585
Compare
f0bd585
to
888dc0f
Compare
@Xaohs merging to unblock, additional review is still appreciated. |
Ready for review