-
Notifications
You must be signed in to change notification settings - Fork 377
feat(Table): Add columnTransforms, classNames decorator, Visibility constants, and hidden/visible breakpoints example #1858
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { css } from '@patternfly/react-styles'; | ||
| import styles from '@patternfly/patternfly/components/Table/table.css'; | ||
|
|
||
| const pickProperties = (object, properties) => | ||
| properties.reduce((picked, property) => ({ ...picked, [property]: object[property] }), {}); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably a better way to do (and standardize) this across more components than just table, but this works for now.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I agree, I don't think there is a clean way to get a subset of an object's properties. I figured this was nicer than the repetition in my original version: |
||
|
|
||
| export const Visibility = pickProperties(styles.modifiers, [ | ||
| 'hidden', | ||
| 'hiddenOnSm', | ||
| 'hiddenOnMd', | ||
| 'hiddenOnLg', | ||
| 'hiddenOnXl', | ||
| 'visibleOnSm', | ||
| 'visibleOnMd', | ||
| 'visibleOnLg', | ||
| 'visibleOnXl' | ||
| ]); | ||
|
|
||
| export default (...classNames) => () => ({ | ||
| className: css(...classNames) | ||
| }); | ||
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.
Love this interface.
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.
Thanks, me too :)