-
Notifications
You must be signed in to change notification settings - Fork 36
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
update toast #517
update toast #517
Conversation
🦋 Changeset detectedLatest commit: 232c665 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
@felicio is attempting to deploy a commit to the Status Team on Vercel. A member of the Team first needs to authorize it. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
I understand the necessity to expand the component API to accommodate other needs. However, I don't think that consumers need to know about implementation details such as actionProps
or rootProps
.
I still think that keeping the first parameter as message
and the second as options
is cleaner way. Then it can be destructured and passed to appropriate components.
options?: { | ||
actionProps?: Pick<ToastProps, 'action' | 'onAction'> | ||
rootProps?: ToastRootProps | ||
} |
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.
type Options = ToastRootProps & Pick<ToastProps, 'action' | 'onAction'>
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.
isn't it clearer that way? wouldn't destructuring for rootProps
instead of its individual fields better ensure it's not passed further down where not expected?
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.
From a component consumer view, I don't see why they'd need to understand what root
and action
are.
The toast API
toast.success("Yaaayy!!", {
duration: 3000,
action: "Undo",
onAction: () => void
})
is much cleaner than nesting it under some arbitrary fields.
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.
which option goes where is an implementational detail.
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.
The component handling the opening of the toast should be explicit about things a user can configure and pass it to the appropriate components (no spreading of props).
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.
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.
thank you
why