Skip to content
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

feat(table): add support to hide/show cells at breakpoints #1748

Merged
merged 1 commit into from
Apr 23, 2019

Conversation

mcoker
Copy link
Contributor

@mcoker mcoker commented Apr 17, 2019

fixes #1725

I had originally made this block of hidden/visible-on-* CSS a mixin that could be included in any component that takes an argument for the display property (for block, table, flex, etc). That might be a good idea in the future if we want to add this kind of functionality to other components.

@patternfly-build
Copy link

Deploy preview for pf-next ready!

Built with commit be24186a040f93a8aea74efbc5ffdbbcbf52dcf1

https://deploy-preview-1748--pf-next.netlify.com

@patternfly-build
Copy link

patternfly-build commented Apr 17, 2019

Deploy preview for pf-next ready!

Built with commit 69c8ce5

https://deploy-preview-1748--pf-next.netlify.com

@mcoker mcoker force-pushed the issue-1725 branch 2 times, most recently from e2665e9 to 7e8ceef Compare April 18, 2019 13:16
Copy link
Contributor

@mattnolting mattnolting left a comment

Choose a reason for hiding this comment

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

&.pf-m-center {
text-align: center;
}

// Hide/show cells at different breakpoints
@include pf-hidden-visible("table-cell");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Love this!

### Usage
| Class | Applied To | Outcome |
| -- | -- | -- |
| `.pf-m-hidden{-on-[breakpoint]}` | `.pf-c-table tr > *` | Hides a table cell at a given breakpoint, or hides it at all breakpoints with `.pf-m-hidden`. |
Copy link
Member

Choose a reason for hiding this comment

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

Maybe make a point that you need to apply the same breakpoint to all cells within the same column, thats something i didnt even think about when i first saw this PR

@@ -152,3 +152,70 @@
scrollbar-width: none; // hides scrollbars in Firefox 64 and up
-ms-overflow-style: -ms-autohiding-scrollbar; // auto hides scrollbars in Edge
}

@mixin pf-hidden-visible($val: "block") {
Copy link
Member

Choose a reason for hiding this comment

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

Were you thinking of updating the other components that use display: none; visibility: hidden within this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh nah, I wasn't planning on it. this mixin was just for the hidden/visible functionality.

@@ -152,3 +152,70 @@
scrollbar-width: none; // hides scrollbars in Firefox 64 and up
-ms-overflow-style: -ms-autohiding-scrollbar; // auto hides scrollbars in Edge
}

@mixin pf-hidden-visible($val: "block") {
&.pf-m-hidden {
Copy link
Member

Choose a reason for hiding this comment

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

I feel like we should make a note that you dont want to use these modifiers on cells like inside of the expandable content. This is what happened when I added those modifiers and we run into the problem where hiding the cell doesnt hide those styles that come with the expansion.

Screen Shot 2019-04-18 at 10 08 59 AM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice, I'll look at that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried this out and it seems to work OK for me. It may have been an issue with how it was written previously.

@mcoker
Copy link
Contributor Author

mcoker commented Apr 22, 2019

@mattnolting @christiemolloy updated.

mattnolting
mattnolting previously approved these changes Apr 22, 2019
@mattnolting mattnolting dismissed their stale review April 22, 2019 18:35

display property is still not correct, looking at a solution

Copy link
Contributor

@mattnolting mattnolting left a comment

Choose a reason for hiding this comment

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

Yep, looks good to me!

@priley86
Copy link
Member

the demo here looks good to me and I would like to prototype w/ the pf-m-hidden-on-* and pf-m-visible-on-* classes downstream. Will also need to think about flexible row widths next (i.e. col-xs-3, col-sm-3, col-md-3, etc.).

One additional thing I noted on visibility while looking at the w3 specs during the table's work so far is that we can use aria-colcount when columns are visible/hidden. We could probably add this during the downstream pf-react integration I'm guessing.
https://www.w3.org/TR/wai-aria-practices-1.1/examples/grid/dataGrids.html

@christiemolloy
Copy link
Member

This is an example of hiding all of the td's in the first <tr> would you expect that bottom line to also be removed in this case?

Screen Shot 2019-04-23 at 10 30 58 AM

@mcoker
Copy link
Contributor Author

mcoker commented Apr 23, 2019

@christiemolloy this feature is for dropping columns. From #1725

Add option to drop column in mobile view

So I would consider that a mis-use of the feature 😁

@mattnolting
Copy link
Contributor

mattnolting commented Apr 23, 2019

@christiemolloy this feature is for dropping columns. From #1725

Add option to drop column in mobile view

So I would consider that a mis-use of the feature 😁

You could hide the entire row with the same method :D

@mcoker
Copy link
Contributor Author

mcoker commented Apr 23, 2019

@mattnolting for sure, this feature is 🔥. Let's add that if we get a request for it.

Copy link
Contributor

@mattnolting mattnolting left a comment

Choose a reason for hiding this comment

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

🔥

tr:not(.pf-c-table__expandable-row) > :not(.pf-c-table__toggle):not(.pf-c-table__check):not(.pf-c-table__action):not(.pf-c-table__sort) {
[data-label] {
// default pf-hidden-visible() mixin is called in table.scss. redefining variable here
--pf-c-table-cell--hidden-visible--Display: var(--pf-c-table-cell--m-grid--hidden-visible--Display);
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@mattnolting mattnolting merged commit 5b6a189 into patternfly:master Apr 23, 2019
@patternfly-build
Copy link

🎉 This PR is included in version 2.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

5 participants