-
Notifications
You must be signed in to change notification settings - Fork 19
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
feat(EmptyState): make titleText optional #770
Conversation
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.
Looking great! Few small things:
...ods/src/rules/v6/emptyStateHeaderMoveIntoEmptyState/emptyStateHeader-move-into-emptyState.ts
Show resolved
Hide resolved
...ods/src/rules/v6/emptyStateHeaderMoveIntoEmptyState/emptyStateHeader-move-into-emptyState.ts
Show resolved
Hide resolved
(hasChildren | ||
? `titleText=${getChildrenAsAttributeValueText( | ||
context, | ||
header.children | ||
)}` | ||
: ""); |
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.
And one nit here: can you refactor this in a simpler way than having a ternary nested inside of an or statement?
const createTitleTextPropFromChildren = () => | ||
hasChildren | ||
? `titleText=${getChildrenAsAttributeValueText( | ||
context, | ||
header.children | ||
)}` | ||
: ""); | ||
: ""; |
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 more even smaller nit, is there an advantage to this being a function rather than just doing something like
const childrenTitleText = hasChildren ? <title text> : ""
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.
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)
Closes #764