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

feat(ui): #1807: add Toast v2 UI component #1817

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

VanishMax
Copy link
Contributor

Closes #1807

Implements Toasts v2. The new API looks like this:

const ToastRenderer = () => {
  const openToast = useToast();

  const onOpen = () => {
    const toast = openToast({
      title: 'Re-rendering toast',
      actionType: 'destructive',
      description: 'This is a toast message. It will re-render in 2 second',
      icon: AlertCircle,
    });

    setTimeout(() => {
      toast.update({
        title: 'Re-rendering toast',
        icon: CheckCircle,
        actionType: 'accent',
        description: 'Wow, not it is updated!',
      });
    }, 2000);
  };

  return <Button onClick={onOpen}>Open re-rendering toast</Button>;
};

As you can see, this API supports not only opening toasts but also mutating their props dynamically.

@VanishMax VanishMax self-assigned this Sep 30, 2024
Copy link

changeset-bot bot commented Sep 30, 2024

⚠️ No Changeset found

Latest commit: b0264f0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copy link
Contributor

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

https://penumbra-ui-preview--pr1817-feat-toasts-v2-zd445xs6.web.app

(expires Mon, 07 Oct 2024 13:40:27 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 709d729610ef7a6369b23f1cb2b820a60cc685b1

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.

Uiv2 Toasts
1 participant