-
Notifications
You must be signed in to change notification settings - Fork 6
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
Set up DataView layout #5
Conversation
@nicolethoen @dlabaj with PF6, I've encountered two visual issues
Do you know if these issues are known? Shall I open issues for these? Thank you |
|
||
A blank example of the data view layout. | ||
You can make use of the predefined layout components to display a default header and footer. See [data view toolbar](/data-view/data-view-toolbar) for more information |
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 also see the a11y tests failing there with link-in-text-block
. The link is added the same way as in the older docs framework version. Did anything change with v6?
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.
You are not the only person who's run into this error during the migration to the v6 alphas. I will have to investigate how others have resolved this issue.
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.
I think the recommended solution (since the rule being flagged by the a11y tests is a 'new experimental rule') is to ignore it.
You can see that being done in another extension here: patternfly/react-catalog-view@bd81ee6
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.
Cool, thank you 🙂
this does appear to be a bug on v6 right now! if you wouldn't mind opening a v6 alpha bug that would be super helpful!
It looks to me that rather than |
export const DataViewToolbar: React.FunctionComponent<DataViewToolbarProps> = ({ className, ouiaId = 'DataViewToolbar', page, perPage, isBottom }: DataViewToolbarProps) => ( | ||
<Toolbar ouiaId={ouiaId} className={className}> | ||
<ToolbarContent> | ||
{page && perPage && ( |
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.
I think we might want to pass a prop pagination
that will have the object shape. That way we can have a bit more strict typing while keeping the feature optional.
@@ -0,0 +1,4 @@ | |||
export interface DataViewPaginationProps { | |||
page?: number; |
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.
This should not be optional.
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.
@Hyperkid123 do you think we want to make perPage mandatory as well? I wonder if our implementation should contain a default value for that or if we want to let that up to the user of our component
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.
I don't think we will be able to "guess" defaults that would make sense.
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.
Just a question. Do you plan all of the toolbar features to be object props? Or do we expect some nodes or children to be passed?
(I understand this is very early on)
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.
@Hyperkid123 I planned to use the node approach for actions - the example is mentioned in the ADR. Do you think it is worth applying also somewhere else? Thank you
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.
I think we want to use one system everywhere. but I think it will get clearer once we move forwards with more.
); | ||
<Stack data-ouia-component-id={`${ouiaId}-stack}`}> | ||
{React.Children.map(children, (child, index) => ( | ||
React.isValidElement(child) ? ( |
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.
I think we want to throw an error if the element is valid. There is no point passing things that are not elements and acting as if it was OK.
text?: string; | ||
export interface DataViewProps extends DataViewPaginationProps { | ||
/** Content rendered inside the data view */ | ||
children?: React.ReactNode; |
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.
This should be mandatory. The view serves no purpose if there are no children.
Also, you should use React.PropsWithChildren
generic so you don't have to add types for children (when they are optional).
@nicolethoen thank you! I've missed the variant prop. It fixes the alignment, I've also opened those issues. |
@Hyperkid123 all comments should be addressed, can you please take a look? |
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.
I think this is good as a base 👍
🎉 This PR is included in version 1.0.0-prerelease.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 5.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
RHCLOUD-32249
DataViewToolbar