-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Toasts v2.1 #834
Toasts v2.1 #834
Conversation
I think this is not needed anymore since the examples have a wrapper with `p-3`.
This pull request is automatically deployed with Now. |
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.
This is looking great, thanks for carrying this along @simurai and @emilybrick! ✨ I just noticed one thing when I was checking out storybook. What do we need to do to finish this up? I can help clean up and write the documentation. Anything else?
pages/css/components/toasts.md
Outdated
@@ -88,8 +88,8 @@ To create a default toast, use `.Toast` | |||
|
|||
```html title="Toast animating" | |||
<div class="p-3"> | |||
<div class="Toast Toast-animated Toast-block-error"> | |||
<span class="Toast-octicon"> | |||
<div class="Toast Toast--error Toast--animateIn"> |
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.
Should the animation be a separate class? Or should they all automatically animate?
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 think animation should be optional. Also, I think the classname should be Toast--animate-in
, no?
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.
Should the animation be a separate class?
Maybe we can revisit this after we see 2-3 use cases. It also depends a bit how a Toast
gets added to the page. On page load and initially hidden or injected only when needed?
@shawnbot I think the classname should be Toast--animate-in, no?
Our naming convention doesn't specify the format when using multiple words for a modifier. So my thinking was to use camelCase to not make it look like the modifier has a child element. SUIT CSS uses the same convention.
I updated the documentation to use the |
+1 here. Even on other pages, it's been difficult to use these docs without examples. |
Yeah, As of today, I guess we have the following options:
Hmmm.. all the options are not that great. 🤔 How about option 5 that is somewhat a combination of 3+4: <span class="Toast-icon">
<!-- <%= octicon "info" %> -->
<svg class="octicon octicon-info" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg>
</span> Then the examples show an icon and it's hopefully obvious enough that the |
Oh.. just remembered two more questions that came up when chatting with @emilybrick + @zainkho.
If so, some sort of wrapper element is needed, like <div class="Toast">
<div class="Toast-item">...</div>
<div class="Toast-item">...</div>
<div class="Toast-item">...</div>
</div> |
Co-Authored-By: Shawn Allen <[email protected]>
`style="fill:currentcolor"` can be used for inline `<svg>`s
I don't think we need to be overly cautious about multiple toasts at this stage.
In the spirit of incremental correctness and keeping this PR lean (so that logbook can use it in the near future), I'd like to propose we leave positioning as utilities. Eventually I do believe this should be in the component (e.g. toasts should always be in the bottom left on desktop 🤷♂), but would like to get this merged in this week. Open to thoughts @ampinsk @shawnbot @simurai Regarding examples, option 5 seems fine to me. I prefer having the examples be in the docs to start, even if we'll eventually need to clean up the longhand. This seems 🆗:
Curious your thoughts @ampinsk ☝️ |
Lemme see if I can get |
Agree with all your proposals @emilybrick! Incrementally correct away 🚀 |
@shawnbot If you are able to get this working in the next day or so that would be helpful, otherwise I suggest we ship with the SVG so that the example looks good (you could use an image tag instead of the svg inline if that's better for the code example). I don't feel strongly though so whatever works to ship this week.
I agree with @emilybrick that we don't need to worry about the container at this stage, use utilities for now and abstract later. I think we'll definitely iterate on this component wants it's had more testing in the real world. @simurai I'd love for this v1 to be shipped this week since @ampinsk is ramping back onto product work soon!
I'd suggest including this information in the docs, this may also be part of design guidelines in future (along with other alert message usage guidelines), however it's fine if this is in a follow up PR. |
I'm sorry, this turns out to be trickier than I'd anticipated. Blueprints' |
👍 Yep, totally fine. Ok, I'll make the following changes:
|
This is needed so that the Toast's margin's don't get collapsed and the example gets cropped.
ty @simurai ! 🙌 |
This is on top of #831 and adds a few tweaks. The diff might be hard to follow, it's mostly:
Toast-octicon
toToast-icon
. Not really necessary, but makes it a bit more generic.<button>
to dismiss instead of a<a>
. This will still need some JS to make it work.Toast-block-default
modifier class so that by default, the icon is blue.block
from the modifier classes. Also uses--
double dash ->Toast--error
. I think this is part of our naming convention. LikeUnderlineNav--right
.Toast--animateIn
andToast--animateOut
. So they can be triggered by JS.