-
Notifications
You must be signed in to change notification settings - Fork 534
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
SelectPanel: Empty State - Explore SelectPanel.Message API and managing visibility of the component under the hood #4988
base: select_panel_loading_states
Are you sure you want to change the base?
Conversation
|
<SelectPanel.Message variant="noitems" title="You haven't created any projects yet"> | ||
<Link href="https://github.com/projects">Start your first project </Link> to organise your issues. | ||
</SelectPanel.Message> | ||
<SelectPanel.Message variant="nomatches" title={`No language found for `}> | ||
Adjust your search term to find other languages | ||
</SelectPanel.Message> |
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.
Spiking about API options for the empty states. After having an initial conversation with @siddharthkp
Option 1 (As above code)
Pros
- Straightforward. Consumers don't need to deal with calculating items length etc to display the empty state messages and which empty state they are going to display i.e. no items vs no matches
Cons
- No flexibility to manage the visibility of the messages since everything is under the hood. There is a chance that it might not work for every usage if consumers have more params in determining the empty states. They can still manage it via this API but it would defeat its main motivation which is handling the complex stuff under the hood.
Option 2
We could simplify the API and let consumers worry about managing the empty state. Like below
<SelectPanel.Message variant="empty" title={noItemsState? `No items created yet' : No language found for'`}>
{noItemsState? `Start creating your items here' : Adjust your search term to find other languages}
</SelectPanel.Message>
Pros
- Simple API
Cons
- Consumers might choose to use the same messages for both empty states.
- A bit more work for consumers to deal with managing the state.
Alternatively we can use a prop rather than children for providing the messages.
<SelectPanel
message={<SelectPanel.Message variant="empty" title={noItemsState? `No items created yet' : No language found for'`}>
{noItemsState? `Start creating your items here' : Adjust your search term to find other languages}
</SelectPanel.Message>}
</SelectPanel>
Curious to hear what you think 🙌🏻 @siddharthkp @camertron
Closes #
Changelog
New
Changed
Removed
Rollout strategy
Testing & Reviewing
Merge checklist