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(EmptyDetailsView): add component #65

Merged
merged 4 commits into from
Jan 7, 2025

Conversation

adamviktora
Copy link
Collaborator

@adamviktora adamviktora commented Nov 22, 2024

Closes #26

direct link to new docs: https://ai-infra-ui-components-pr-65.surge.sh/ai-infra-ui-components/emptydetailsview

Issues:

  • cannot add props to EmptyStateHeader (it is now an internal component in Patternfly), thus data-testid="empty-state-title" must be removed, might be worth opening an issue in pf-react?

@patternfly-build
Copy link

patternfly-build commented Nov 22, 2024

Copy link
Contributor

@nicolethoen nicolethoen left a comment

Choose a reason for hiding this comment

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

It's hard for me to gage how inconvenient it'll be that the test-id is not exposed any more. Once they migrate to PF6, they will have to cross that bridge themself if they decide it matters, so for now, I think it's okay to not worry about that one item in the hidden component.

/** Source path to an icon image. */
iconImage?: string;
/** Alternative text for icon image if image can't load. */
imageAlt?: string;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need alt text for this image? This image is purely decorative and doesn't provide any additional meaning to the user that isn't already provided with the contents on the page.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The prop must stay there so the interface is the same as in the original component (https://github.com/opendatahub-io/odh-dashboard/blob/main/frontend/src/components/EmptyDetailsView.tsx), it was an agreement with Jeff that we don't change it so the migration is easy. But it is a good point and something to potentially enhance in the future

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for the explanation. That makes sense. I think we can keep the prop, but my suggestion would be to set the example to have the following value:
imageAlt=""

And also modify the code so that this results in the following html:
alt="" (vs just the alt that results from having an empty prop value)

You can see more details about this practice for decorative images here: https://www.w3.org/WAI/tutorials/images/decorative/

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That makes perfect sense. Also can we overwrite the prop value to always result in alt="" even if consumer provides an alt text? (so we basically remove the ability to set an alt text, without actually removing the prop)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure about always overwriting the prop value to result in alt="", and would want @nicolethoen or @jeff-phillips-18 to comment on whether we always ignore values specified in the imageAlt prop. Our usage of these images is decorative, and don't provide meaningful contents to the user, so we would want our examples to reflect that.

But I'm not sure where these components would be consumed, and there's always a possibility that a consumer would choose to use an image that does provide meaningful contents, for which they would need a description.

/** Button which initiates the creation. */
createButton?: React.ReactNode;
/** Extra children to render inside EmptyStateFooter. */
footerExtraChildren?: React.ReactNode;
Copy link
Collaborator

Choose a reason for hiding this comment

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

The example provided in the preview shows an empty state with just a single primary action, but it would be good to have an example that shows a secondary action, too.

title="Start by adding cluster storage"
description="Cluster storage saves your project’s data on a selected cluster. You can optionally connect cluster storage to a workbench."
iconImage={clusterImage}
imageSize="240px"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we change 240px to 320px

Also, this size is different than the size shown in /EmptyDetailsView/EmptyDetailsView.tsx below, which is using 320px.

We have new guidelines for empty states that recommend using 320px for illustrations. It would be ideal if our examples in the preview use the values we are recommending.

@jgiardino
Copy link
Collaborator

Overall this looks good. I did have a few requests regarding the preview examples, and one question about image alt text that would be good to get someone else's opinion on.

- using "type" with Omit instead of "interface" doesn't work for some reason with docs-framework
Copy link
Collaborator

@jgiardino jgiardino left a comment

Choose a reason for hiding this comment

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

The component and example look good from a UX perspective.

@adamviktora adamviktora merged commit 3cb20f0 into patternfly:main Jan 7, 2025
5 checks passed
Copy link

github-actions bot commented Jan 7, 2025

🎉 This PR is included in version 1.5.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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EmptyDetailsView - migrate from ODH and document API
4 participants