-
Notifications
You must be signed in to change notification settings - Fork 354
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
Charts: Simplify pattern visibility #7542
Charts: Simplify pattern visibility #7542
Conversation
Preview: https://patternfly-react-pr-7542.surge.sh A11y report: https://patternfly-react-pr-7542-a11y.surge.sh |
54205bc
to
0471596
Compare
b862cf8
to
f8617fa
Compare
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.
The prop description for patternScale reads, This prop should be given as an array of CSS colors, or as a string corresponding to a URL
. Do you have an example of using an array of CSS colors?
And is patternScale still the most logical name for this prop? I wonder if something like patternDefs or patternOptions or something like that feels a little closer to its intended usage, possibly?
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.
one other idea
import uniqueId from 'lodash/uniqueId'; | ||
|
||
// @beta | ||
export interface PatternScaleInterface { |
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.
It may be possible to include this interface in the prop description tables at the bottom of the Patterns page. We do that a lot with the more complex types for the Composable Table components like this one.
As long as the type is exported so it can be imported in the examples, the PatternScaleInterface
can be added to the list of propComponents
in patterns.md. And then you can give yourself more space to write prop descriptions in this interface rather than using the same long prop description on each chart example.
by default, adding the PatternScaleInterface should create a link in each Chart prop table to link to it on the docs page, as you can see done in the Tables docs
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, I've fixed the patternScale
description.
I'd like to stick with the patternScale
name because it mimics behavior of the existing colorScale
prop. Both define the order in which items are applied, while colors / patterns repeat when there are more children than items.
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.
@nicolethoen I removed PatternScaleInterface
and created hasPatterns
. That should help make things more clear.
hasPatterns={[ true, true, false ]} // hide the last pattern
Devs only need to use patternScale
when creating custom patterns.
f8617fa
to
699ae10
Compare
2fc2849
to
3742fdf
Compare
…tternDefs` prop with `hasPatterns`
3742fdf
to
a5e94b5
Compare
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.
LGTM
Your changes have been released in:
Thanks for your contribution! 🎉 |
Refactored the pattern feature to eliminate the pattern IDs required to hide / show individual patterns. This helps to simplify a few chart examples.
Previously, individual patterns were hidden using
null
values. However, that required some knowledge of our generated pattern IDs. For example:I want to simplify this using boolean flags, like so:
And to show patterns for all chart segments, this reduces to:
That said, if devs choose to create custom patterns, they can still provide their own IDs.
Design issue: patternfly/patternfly-org#4369
Closes #7541