-
Couldn't load subscription status.
- Fork 8
feat: Define CSS classes for levels of Toast component
#677
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: Define CSS classes for levels of Toast component
#677
Conversation
|
Or CSS variables? Something like Not sure what's the common pattern but, I guess we rarely assume the consumer uses CSS selector, we probably do so in OISY as a hack... |
|
@peterpeterparker you mean creating an Basically: <!-- Toast -->
...
<div
data-tid="toast-component"
role="dialog"
class={`toast ${theme ?? "themed"}`}
style={`--overlay-background: var(--toast-background-${level}, var(--overlay-background));
--overlay-background-contrast: var(--toast-background-contrast-${level}, var(--overlay-background-contrast));
--toast-inverted-background: var(--toast-inverted-background-${level}, var(--toast-inverted-background));
--toast-inverted-background-contrast: var(--toast-inverted-background-contrast-${level}, var(--toast-inverted-background-contrast));`}
in:fly|global={{ y: (position === "top" ? -1 : 1) * 100, duration: 200 }}
out:fade|global={{ delay: 100 }}
>
....
WDYT? |
|
I was thinking defining those in the |
|
@peterpeterparker ah understood! Look at last commit pls, is that? |
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.
Wait so it was already there, we just want to have more flexibility, is that right?
If so, can you update title and description of the PR accordingly?
Toast componentToast component
|
@peterpeterparker ready for another review pls |
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.
LGTM, thx
Motivation
Just an idea: it would be easier to customize the Toast style using CSS styles, if we add the level among the classes.
For example, in OISY, if we want to customize the background of an error toast we need to use the icon child:
While we could do:
So, we define custom CSS classes for each level of
Toast: background and foreground, inverted or not.