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

Extract brick selector from BrickModal #4212

Closed
fregante opened this issue Sep 1, 2022 · 2 comments
Closed

Extract brick selector from BrickModal #4212

fregante opened this issue Sep 1, 2022 · 2 comments

Comments

@fregante
Copy link
Contributor

fregante commented Sep 1, 2022

BrickModal is an easy-to-use all-in-one component that handles the whole flow: from the opener button, to the modal, to the picker UI.

I remember maybe Todd mentioning this: passing a Button to a Modal component feels backwards:

<BrickModal
bricks={menuItemExtensionPoints ?? []}
caption="Select button foundation"
renderButton={(onClick) => (
<Button
variant="info"
onClick={onClick}
disabled={!menuItemExtensionPoints?.length}
>
<FontAwesomeIcon icon={faSearch} /> Search Marketplace
</Button>
)}
onSelect={async (block) => addExisting(block as MenuItemWithConfig)}
/>

The current structure has a few drawbacks:

  • the brick picker UI can only be displayed in a modal
  • the opener button can never itself be placed in a modal, or else you end up with nested modals
  • if the opener button is not part of the following view (i.e. removed from the dom), the modal won't have a closing animation
  • one BrickModal can only have one button

Suggested changes

  • create modal-less BrickPicker component, then import it into BrickModal

This would still allow BrickModal usage as a shortcut component while also enabling alternative usage.

Related

Copy link

This issue will be closed in 7 days unless the stale label is removed, or a comment is added to the issue.

@github-actions github-actions bot added the Stale label Dec 19, 2023
Copy link

This issue was closed because it has been stale for 7 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant