✨ Create Dashboard Filter Component (#1983)#2006
Conversation
|
|
||
| &.ReactTable { | ||
| border: none; | ||
| &.has-filters { |
There was a problem hiding this comment.
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
| display: inline-block; | ||
| position: absolute; | ||
| width: 36px; | ||
| width: 12px; |
There was a problem hiding this comment.
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 = {}, | ||
| }: { |
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.
man, that's clever!!! I saw this as a blocker with UiKit, because they hadn't updated their type stuff
| unmountHTMLWhenHide: boolean('unmountHTMLWhenHide', undefined), | ||
| sticky: boolean('sticky', undefined), | ||
| stickyDuration: number('stickyDuration', undefined), | ||
| stickyDuration: boolean('stickyDuration', undefined), |
There was a problem hiding this comment.
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.
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.
Definitely pulled some hair out and cursed at TypeScript quite a bit during this :P
There was a problem hiding this comment.
Nah, it's React. They rewrote all that stuff in v17.
There was a problem hiding this comment.
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 <2107110+caravinci@users.noreply.github.com>
Description of changes
Adds a new
DropdownPanelcomponent to UIKit which consists of:customTriggerprop)childrento theDropdownPanelcomponentStorybook: https://feat-1983-donor-id-table-filter--argo-ui-storybook.netlify.app/?path=/story/uikit-dropdownpanel--basic
Also includes a [WIP] instance of the
DropdownPanelbeing used as a filter in the column header for the Dashboard's Donor Summary Table to filter based on theDonor IDcolumnAs 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 coloursTooltipcomponent arrow optionalreact-tippytooltip libraryInputcomponent inforwardRefto allow ref sharingonBlurandtypeprops toButtoncomponent to allow for focus change handling and to specifytype="submit"vstype="button"ReactTablestyling 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: