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

Truncate Toast description #1929

Closed
wants to merge 3 commits into from
Closed

Conversation

JasonMHasperhoven
Copy link
Contributor

  • Fixes the case where it may take up the whole screen incase we directly log an error message as description

Copy link

changeset-bot bot commented Nov 27, 2024

🦋 Changeset detected

Latest commit: 8d779c7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@penumbra-zone/ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@JasonMHasperhoven JasonMHasperhoven requested a review from a team November 27, 2024 15:50
Copy link
Contributor

github-actions bot commented Nov 27, 2024

Visit the preview URL for this PR (updated for commit 8d779c7):

https://penumbra-ui-preview--pr1929-toast-description-tr-8zq40w0b.web.app

(expires Wed, 04 Dec 2024 15:52:18 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 709d729610ef7a6369b23f1cb2b820a60cc685b1

Comment on lines +79 to +82
description:
typeof options.description === 'string'
? truncateString(options.description, 200)
: options.description,
Copy link
Contributor

Choose a reason for hiding this comment

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

issue: i don't think this should be a part of the UI component. If users need this, they can truncate the string in their code when passing description to the Toast. Moreover, UI components should not trim the string programmatically – this worsens the UX. Think of it as a long but important error message – what might happen if users see the start but not the important end of the message?

From the UI components part, we could add "show more"/"show less" buttons if this is really necessary. But still, the description is defined as ReactNode, so this can be done on the users' side.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suppose you're right, but I have no idea where this long error message throwIfAborted comes from.

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.

2 participants