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(EmptyState): make titleText optional #770

Merged

Conversation

adamviktora
Copy link
Contributor

Closes #764

Copy link
Collaborator

@wise-king-sullyman wise-king-sullyman left a comment

Choose a reason for hiding this comment

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

Looking great! Few small things:

Comment on lines 239 to 244
(hasChildren
? `titleText=${getChildrenAsAttributeValueText(
context,
header.children
)}`
: "");
Copy link
Collaborator

Choose a reason for hiding this comment

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

And one nit here: can you refactor this in a simpler way than having a ternary nested inside of an or statement?

Comment on lines 237 to 243
const createTitleTextPropFromChildren = () =>
hasChildren
? `titleText=${getChildrenAsAttributeValueText(
context,
header.children
)}`
: "");
: "";
Copy link
Collaborator

Choose a reason for hiding this comment

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

One more even smaller nit, is there an advantage to this being a function rather than just doing something like

const childrenTitleText = hasChildren ? <title text> : ""

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, you are right, my thought around this was that if titleTextPropValue is not an empty string, then the second part of the OR operator won't be evaluated. But the function is super simple, so I guess it really doesn't make any difference performance-wise (and it is Javascript, so it's slow anyways)

@wise-king-sullyman wise-king-sullyman merged commit 81c9dad into patternfly:main Sep 26, 2024
3 checks passed
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.

EmptyState - enhance autofixer for when titleText and children are not present
3 participants