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

icon={false} not rendering as expected for Callout component #577

Closed
liaprins opened this issue Aug 25, 2023 · 1 comment
Closed

icon={false} not rendering as expected for Callout component #577

liaprins opened this issue Aug 25, 2023 · 1 comment
Assignees
Labels
Bug Something isn't working Hackday P1

Comments

@liaprins
Copy link
Contributor

Describe the bug
Setting the icon prop for the Callout component to {false} should remove the icon, but it does not.

To Reproduce
Steps to reproduce the behavior:

  1. Add icon={false} as a prop to the Callout component (e.g. in a Storybook test, where it can easily be checked)

Expected behavior
This should remove the icon, like it does for the MUI component it is built upon. I also verified with Timmy that this is the expected behavior; see more in a Zeroheight comment here.

Recommended fix (per @tihuan ), documenting here for posterity:
Change the source code from

if (icon) return icon;

to:

if (icon !== undefined) return icon;

"And then the following will work:
icon={false} - it will not take up space in the component. Similar to display: none;
icon={<></>} - it will still take up space in the component, but just empty space. Similar to visibility: hidden;
icon={null} - this is a little counter intuitive, but it will fall back to using MUI's iconMapping"
(Thanks, @tihuan !!!)

@liaprins liaprins added the Bug Something isn't working label Aug 25, 2023
@liaprins liaprins self-assigned this Aug 25, 2023
@liaprins
Copy link
Contributor Author

PR #717 is first pass to fix this:
#717

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Hackday P1
Projects
None yet
Development

No branches or pull requests

3 participants