-
-
Notifications
You must be signed in to change notification settings - Fork 297
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: toast enhancement #1637
Feat: toast enhancement #1637
Conversation
🦋 Changeset detectedLatest commit: 88dd8cc 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 |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
wow you literally went through every change in my list and knocked it out of the park!
If someone wanted to use this, Is there a way to grab the ID from somewhere other than the callback?
I don't think it's that needed but maybe a slight transform to make it slightly bigger on hover?
I think resetting it is fine. |
@Mahmoud-zino I'll circle back to this soon - but make sure you adjust the Changeset to be a paragraph style. This is the data that'll appear on the generated changelog, so if it's an odd format it may not come through as desired. We should have our first look at the changelog format in the next hour or so, so keep an eye out for that. |
Is there a specific use case you could use? I thought it only makes sense to close them when you trigger them -> you grab the Id from the callback, but if there is another use case I would be happy to implement it. |
I guess I just wondered if you could set a custom ID yourself instead of having to grab it from the callback. |
I understand where this is coming from, but the user can't do anything with the Id other than close the toast, and if it is not random/unique generated it could lead to some unwanted behaviors. so I think it is better to handle it ourselves... If in the future we had any situation where the user could use the ID we can export it very easily. |
Hey @Mahmoud-zino, the logic for these new features looks sound. The only issues I have are in relation to param naming and the documentation presentation. If you can implement the following I'd be happy to merge this: Param changes:
Doc Changes:
Additionally you may want to modify the changeset to more accurate represent the changes above. Remember the changeset should only describe the change, not provide the implementation details. That's where the PR link and documention comes into play. I'd recommend something like:
|
from what I know, interfaces can't have a default value, do you have another suggestion for the name (opposite of dismissable, I was thinking undismissable but it sounds a little bit odd)? |
Sorry I meant the default behavior - not anything that has to be defined in the code. But I do agree we should flip the semantics meaning the other way around. Let me check what other libraries do for this. |
@endigo9740 |
@Mahmoud-zino unfortunately https://github.com/mzohaibqc/svelte-toasts (see the readme) I agree flipping between positive/negative boolean values feels weird, but as long as it's documented it should work. The other option would be to make dismiss a off-by-default feature, then having |
@endigo9740 The problem is we can't change the default value of the prop (because we are using an interface) so I don't understand what you meant by flipping back to "hideDismiss: true" (also in PR it was false) if we could somehow have true as default value I would make sure to document it but I don't know if it is possible. |
@Mahmoud-zino again the default state is implicit rather than explicit within the code. If a value like
This will be our short term implementation for this feature. But when v2 rolls around we might want to swap the defaults to be like this:
However, this would be a breaking change, so we cannot implement this right now. But the semantics and state of Passing |
@endigo9740 aww now I get you, yeah sorry for misunderstanding that like 3 times (Monday effect 😶) It makes sense, I will make the change 👍. |
@Mahmoud-zino I fixed a small style issue that was providing a gap on the right side of the toast when the dismiss option is hidden. Likewise the docs felt like a ton of examples without context, so I've adjusted this to provide more information about each type of setting. I think with this we're good to merge! |
Linked Issue
Closes #1311
Description
Done
hideDismiss
.hoverVisible
.Notes
hideDismiss
and the toast will stay on screen infinitely. so I have set autohide to true automatically whenhideDismiss
is set and wrote a note in the docs about it.hoverVisible
is set so the user knows that hovering the toast will keep it open?mouseLeave
or is it ok to just reset the timer?trigger
function, I don't think this change should be a breaking change, but I just wanted to make sure.Changsets
feat: Toast enhancement - ability to
hide the close button
, ability toremain visible on hover
, ability toclose toasts programmatically
by Id.Checklist
Please read and apply all contribution requirements.
dev
branch (NEVERmaster
)docs/
,feat/
,chore/
,bugfix/
pnpm check
pnpm format
pnpm test