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

update toast #517

Merged
merged 9 commits into from
Dec 15, 2023
Merged

update toast #517

merged 9 commits into from
Dec 15, 2023

Conversation

felicio
Copy link
Collaborator

@felicio felicio commented Dec 11, 2023

why

Copy link

changeset-bot bot commented Dec 11, 2023

🦋 Changeset detected

Latest commit: 232c665

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

This PR includes changesets to release 1 package
Name Type
@status-im/components 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

Copy link

vercel bot commented Dec 11, 2023

@felicio is attempting to deploy a commit to the Status Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

vercel bot commented Dec 11, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
status-components ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 15, 2023 3:31pm

Copy link
Collaborator

@prichodko prichodko left a 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.

Comment on lines 19 to 22
options?: {
actionProps?: Pick<ToastProps, 'action' | 'onAction'>
rootProps?: ToastRootProps
}
Copy link
Collaborator

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'>

Copy link
Collaborator Author

@felicio felicio Dec 15, 2023

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?

Copy link
Collaborator

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.

Copy link
Collaborator

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.

Copy link
Collaborator

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).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@felicio felicio requested a review from prichodko December 15, 2023 13:00
Copy link
Collaborator

@prichodko prichodko left a comment

Choose a reason for hiding this comment

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

thank you

@felicio felicio merged commit f9b9220 into status-im:main Dec 15, 2023
2 checks passed
@felicio felicio self-assigned this May 9, 2024
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