Skip to content

Conversation

@cchaos
Copy link

@cchaos cchaos commented Nov 8, 2021

@constancecchen

Here's a quick PR (I've detailed the changes in the commits). Mostly just some design tweaks, adding tooltips, and updating the examples to showcase "Real world" examples.

Let me know if you have any questions.

anchorPosition="downRight"
panelPaddingSize="s"
panelClassName="euiDataGrid__controlPopover"
panelClassName="euiDataGrid__stylePopoverPanel"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still needs the generic .euiDataGrid__controlPopover class, as that CSS has transform/z-index stuff specific to all toolbar popovers

Suggested change
panelClassName="euiDataGrid__stylePopoverPanel"
panelClassName="euiDataGrid__controlPopover euiDataGrid__stylePopoverPanel"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That transform stuff is actually only needed on popovers whose contents contains the drag-and-drop functionality like the sort and column selector. This new popover is just a simple form.

Copy link
Owner

@cee-chen cee-chen Nov 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohhh that's super good to know! Now I feel like I should have named that CSS class better. I'll fix that after this merges

@cchaos cchaos requested a review from cee-chen November 8, 2021 20:18
Comment on lines +51 to +62
useEffect(() => {
// When data grid is full screen, we add a class to the body to remove the extra scrollbar and stay above any fixed headers
if (isFullScreen && typeof document !== 'undefined') {
document.body.classList.add(GRID_IS_FULLSCREEN_CLASSNAME);

return () => {
if (typeof document !== 'undefined') {
document.body.classList.remove(GRID_IS_FULLSCREEN_CLASSNAME);
}
};
}
}, [isFullScreen]);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super awesome fix, thanks! Do you think this needs a changelog entry or probably not?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't hurt to give it a callout

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And I think that actually closes this: elastic#5092

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I added a changelog entry and a closes commit (which I think should auto close on merge to main?)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly don't know if a commit message will. But might as well add it to your PR summary as well.

Comment on lines +68 to +71
const buttonLabel = useEuiI18n(
'euiStyleSelector.buttonText',
'Display options'
);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 Nice, thanks for the copy-fu!

}
}

.euiDataGrid__controlBtn {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic, thanks for cleaning this up!

@cee-chen cee-chen merged commit 5ba6a95 into cee-chen:datagrid-toolbar Nov 8, 2021
cee-chen pushed a commit that referenced this pull request Nov 10, 2021
* [Setup] Move toolbar CSS to own file

* [Cleanup] DRY out repeated specific CSS class

- naming was incorrect in the case of the style selector popover

* Reorder toolbar per Caroline's mocks

- Columns & Sort on left, with additionalControls to the right of those (+ update prop types to indicate that)

- Style (TBD naming) and Fullscreen to the right

* Convert display buttons to icons only

+ tweak grid styles icon to match Caroline's mock + popover location

* Convert density UI to a compressed EuiFormRow w/ new text/order per mocks

- refactor densityOptions to const outside hook

* Update test snapshots

* Add changelog entry

* [PR feedback] Revert location of additionalControls + fix props description

* [PR feedback] CSS feedback

* [PR feature request] Change toolbar icon based on grid density

* [PR feedback][extra] Fix missing sort control on styling example

NB: sorting functionality won't actually work/isn't hooked up, but this should at least allow the show/hide UI toggle to work as expected

* updoot snaps

* Fix changelog

* [misc] Reorganize EuiDataGridToolbar utils to bottom of file

- makes it easier for devs to immediately jump to the main component/fn, rather than have to scroll past helper/minutae details

- if it gets complex enough, also worth pulling out to a separate file

* Rename CSS toolbar class to left/right to match API

- Per GH discussion display/data is ambiguous and naming this left/right is likely more helpful

* Add API support for left/right positioning of `additionalControls`

* Update additionalControls documentation + example

* PR feedback & cleanup from Caroline (#4)

* Update some props comments and fix popover’s responsiveness

* [Design] Remove a few extraneous style overrides to control buttons

And lower left padding

* Fixed add/remove of fullscreen body class

* Added tooltips around icon buttons with long delay

* Updated examples and snippets with “real world” examples

Removed all the unnecessary manual additions of `className="euiDataGrid__controlBtn”`

* More responsive fixes

* Change class name

* Update CSS class to be more specific

- It isn't necessary for popovers without drag & drop, name becomes verbose but it's hopefully worth it for clearer usage

* closes elastic#5092 - add changelog for fullscreen bugfix in Caroline's work

* [PR feedback] Changelog

* Update snapshots

* PR feedback

* Remove unused CSS class

- Class was removed in a previous commit by Caroline

Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
@cchaos cchaos deleted the datagrid-toolbar branch March 4, 2022 03:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants