-
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
✨ Create Dashboard Filter Component (#1983) #2006
Conversation
@@ -43,6 +43,21 @@ export const StyledTable = styled<typeof ReactTable, StyledTableProps>(ReactTabl | |||
|
|||
&.ReactTable { | |||
border: none; | |||
&.has-filters { |
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.
Quick explainer on these table styles:
- for tables with header filters, we want to prevent the opacity change when there is no data so that the filters still look interactive
- for tables with header filters, we want to make sure the table has a min-height so that the filter panel can be visible when open, regardless of the amount of data in the table
- because of the min-height, we need to apply the negative margin-bottom when there is no data so that the "No data found in table" component appears as normal on tables with filters
Kind of hacky, but this classname solution seemed like the least intrusive approach to make sure everything still works as expected
@@ -221,10 +233,10 @@ export default css` | |||
&.ReactTable .rt-resizer { | |||
display: inline-block; | |||
position: absolute; | |||
width: 36px; | |||
width: 12px; |
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.
Quick explainer for these rt-resizer style changes:
- because we're adding filter buttons inside the table headers, we need to shrink the touch area for the column resizers so they don't over lap the new filter buttons
Updated Storybook with the latest changes |
* Adds a new "Filter" icon to the UIKit icon collection
* Adds support for custom fill colour on hover of interactive icons
* Upgrade react-tippy from v1.2.3 to v1.4.0 * Use TooltipProps from react-tippy library instead of exposing them manually * Make tooltip arrow optional
This reverts commit c980e74.
* Adds boolean prop `arrow` to Tooltip for controlling the visibility of the tooltip arrow
* Upgrade react-tippy from v1.2.3 to v1.4.0 * Use TooltipProps from react-tippy library instead of exposing them manually
* Enables ref forwarding to Input component instances
* Adds a new `DropdownPanel` component to UIKit which renders a trigger button that, upon clicking, expands a panel which can be populated by content passed in as `children`
* Implements the Donor ID Filter to the Donor Summary Table via a custom column header containing a DropdownPanel with a text filter * TODO: connect the filter text to the API
* Moves code related to the text input filter for dropdown panels out of the Donor Summary Table page and into the DropdownPanel component. Cleans up imports, keeps everything related to the panel in one location for better reuse later on.
* Update Program Donor Summary query to support filters * Connect UI to Donor ID filter API
* Set table header filter icon to blue when filter is active, regardless of whether or not the panel is open, to indicate that it is currently being applied
* Apply `min-height` to table so the panel can be used without scrolling when there isn't enough data * Prevent table header opacity change when all data is filtered out
0ae376f
to
28bc668
Compare
Rebasing PR over edit: it's alive! |
sorts, | ||
filters, | ||
options = {}, | ||
}: { |
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.
💪
components/pages/submission-system/program-dashboard/DonorDataSummary/index.tsx
Outdated
Show resolved
Hide resolved
// exposing full react-tippy API based on https://github.com/tvkhoa/react-tippy | ||
// extending the html prop to support our previous implementation which also accepted strings | ||
export type TooltipProps = Omit<TippyProps, 'html'> & { | ||
html?: React.ReactElement<any> | React.ReactNode | 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.
man, that's clever!!! I saw this as a blocker with UiKit, because they hadn't updated their type stuff
@@ -53,7 +53,7 @@ const TooltipStories = storiesOf(`${__dirname}`, module).add( | |||
transitionFlip: boolean('transitionFlip', undefined), | |||
unmountHTMLWhenHide: boolean('unmountHTMLWhenHide', undefined), | |||
sticky: boolean('sticky', undefined), | |||
stickyDuration: number('stickyDuration', undefined), | |||
stickyDuration: boolean('stickyDuration', undefined), |
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 the type issue I found at tippy! grr
There's been a PR to fix it since 2020
tvkhoa/react-tippy#133
<StyledInputWrapper | ||
size={size as StyledInputWrapperProps['size']} | ||
onClick={(e) => { | ||
if (inputRef.current && e.target !== clearButtonRef?.current) inputRef.current.focus(); |
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.
yeah, events' prevent default and bubbling control was iffy in React 16.
I can see the hoops you've had to jump through to make this one work... 💪
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.
Definitely pulled some hair out and cursed at TypeScript quite a bit during this :P
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.
Nah, it's React. They rewrote all that stuff in v17.
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.
Made a couple (non-show-stopping) suggestions, which you should feel free to add or dismiss...
This PR looks pretty darn good otherwise. Ready to squash and merge
! 💪
Of note, I've committed a fix for the Input's declaration, so Storybook can identify it correctly again.
(Updated the temporary storybook link, for verification)
Co-authored-by: Anders Richardsson <[email protected]>
Description of changes
Adds a new
DropdownPanel
component to UIKit which consists of:customTrigger
prop)children
to theDropdownPanel
componentStorybook: https://feat-1983-donor-id-table-filter--argo-ui-storybook.netlify.app/?path=/story/uikit-dropdownpanel--basic
Also includes a [WIP] instance of the
DropdownPanel
being used as a filter in the column header for the Dashboard's Donor Summary Table to filter based on theDonor ID
columnAs well as some smaller changes to ensure the new component works:
InteractiveIcon
's hover functionality through props to allow the parent to specify different hover coloursTooltip
component arrow optionalreact-tippy
tooltip libraryInput
component inforwardRef
to allow ref sharingonBlur
andtype
props toButton
component to allow for focus change handling and to specifytype="submit"
vstype="button"
ReactTable
styling changes to shrink the width of the draggable area for column resizers to prevent collision with filter buttons in column headersType of Change
Checklist before requesting review: