Skip to content

Commit 56b3dae

Browse files
authored
Merge pull request #834 from primer/toasts-v2.1
Toasts v2.1
2 parents 331a96f + bd43628 commit 56b3dae

File tree

2 files changed

+150
-140
lines changed

2 files changed

+150
-140
lines changed

pages/css/components/toasts.md

Lines changed: 101 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -7,119 +7,150 @@ source: ''
77
bundle: toasts
88
---
99

10-
# Toasts
10+
Toasts are used to show live, time-sensitive feedback to users.
1111

12-
To create a default toast, use `.Toast`
1312

14-
## Default style
13+
## Default
1514

16-
```html title="Block style"
17-
<div class="p-3">
18-
<div class="Toast Toast-block-default">
19-
<span class="Toast-octicon">
20-
<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>
21-
</span>
22-
<span class="Toast-content">Submitting issue to <strong>github/github</strong></span>
23-
</div>
24-
<div class="Toast Toast-block-warning">
25-
<span class="Toast-octicon">
26-
<svg class="octicon octicon-alert" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"></path></svg>
15+
To create a default toast, use `.Toast`. Always use the `info` icon for default messages.
16+
17+
```html title="Default toast"
18+
<div class="p-1">
19+
<div class="Toast">
20+
<span class="Toast-icon">
21+
<!-- <%= octicon "info" %> -->
22+
<svg class="octicon octicon-info" style="fill:currentColor" 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>
2723
</span>
28-
<span class="Toast-content">Submitting issue to <strong>github/github</strong></span>
24+
<span class="Toast-content">Toast message goes here</span>
2925
</div>
30-
<div class="Toast Toast-block-success">
31-
<span class="Toast-octicon">
32-
<svg class="octicon octicon-check" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5L12 5z"></path></svg>
26+
</div>
27+
```
28+
29+
The Toast content is formattable. We recommend keeping your message under 140 characters.
30+
31+
```html title="Toast with long text"
32+
<div class="p-1">
33+
<div class="Toast">
34+
<span class="Toast-icon">
35+
<!-- <%= octicon "info" %> -->
36+
<svg class="octicon octicon-info" style="fill:currentColor" 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>
3337
</span>
34-
<span class="Toast-content">Submitting issue to <strong>github/github</strong></span>
38+
<span class="Toast-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. <strong>Aenean commodo ligula eget dolor.</strong> Aenean massa. Cum sociis <em>natoque</em> penatibus et ma</span>
3539
</div>
36-
<div class="Toast Toast-block-error">
37-
<span class="Toast-octicon">
38-
<svg class="octicon octicon-stop" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M10 1H4L0 5v6l4 4h6l4-4V5l-4-4zm3 9.5L9.5 14h-5L1 10.5v-5L4.5 2h5L13 5.5v5zM6 4h2v5H6V4zm0 6h2v2H6v-2z"></path></svg>
40+
</div>
41+
```
42+
43+
## Variations
44+
45+
Use the success, warning, and error modifiers to communicate different states.
46+
47+
Always use the `check` octicon for success states.
48+
49+
```html title="Success toast"
50+
<div class="p-1">
51+
<div class="Toast Toast--success">
52+
<span class="Toast-icon">
53+
<!-- <%= octicon "check" %> -->
54+
<svg class="octicon octicon-check" style="fill:currentColor" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5L12 5z"></path></svg>
3955
</span>
40-
<span class="Toast-content">Submitting issue to <strong>github/github</strong></span>
56+
<span class="Toast-content">Success message goes here.</span>
4157
</div>
4258
</div>
4359
```
4460

45-
## Toast with dismiss
61+
Always use the `alert` octicon for warning states.
4662

47-
```html title="Toast with dismiss"
48-
<div class="p-3">
49-
<div class="Toast Toast-block-error">
50-
<span class="Toast-octicon">
51-
<svg class="octicon octicon-alert" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"></path></svg>
63+
```html title="Warning toast"
64+
<div class="p-1">
65+
<div class="Toast Toast--warning">
66+
<span class="Toast-icon">
67+
<!-- <%= octicon "alert" %> -->
68+
<svg class="octicon octicon-alert" style="fill:currentColor" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"></path></svg>
5269
</span>
53-
<span class="Toast-content">Submitting issue to <strong>github/github.</strong></span>
54-
<a class="Toast-dismiss"><svg class="octicon octicon-x" viewBox="0 0 12 16" version="1.1" width="12" height="16" role="img"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48L7.48 8z"></path></svg></a>
70+
<span class="Toast-content">Warning message goes here.</span>
5571
</div>
5672
</div>
5773
```
5874

75+
Always use the `stop` octicon for error states.
5976

60-
## Toast with link
61-
62-
```html title="Toast with link"
63-
<div class="p-3">
64-
<div class="Toast Toast-block-error">
65-
<span class="Toast-octicon">
66-
<svg class="octicon octicon-alert" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"></path></svg>
77+
```html title="Error toast"
78+
<div class="p-1">
79+
<div class="Toast Toast--error">
80+
<span class="Toast-icon">
81+
<!-- <%= octicon "stop" %> -->
82+
<svg class="octicon octicon-stop" style="fill:currentColor" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M10 1H4L0 5v6l4 4h6l4-4V5l-4-4zm3 9.5L9.5 14h-5L1 10.5v-5L4.5 2h5L13 5.5v5zM6 4h2v5H6V4zm0 6h2v2H6v-2z"></path></svg>
6783
</span>
68-
<span class="Toast-content">Submitting issue to <strong>github/github. </strong><a href="#">Try again.</a></span>
84+
<span class="Toast-content">Error message goes here</span>
6985
</div>
7086
</div>
7187
```
7288

73-
## Toast with link and dismiss
89+
## Toast with dismiss
90+
91+
Use `.Toast-dismissButton` to allow a user to explicitly dismiss a Toast.
7492

75-
```html title="Toast with action and dismiss"
76-
<div class="p-3">
77-
<div class="Toast Toast-block-error">
78-
<span class="Toast-octicon">
79-
<svg class="octicon octicon-alert" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"></path></svg>
93+
```html title="Toast with dismiss"
94+
<div class="p-1">
95+
<div class="Toast">
96+
<span class="Toast-icon">
97+
<!-- <%= octicon "info" %> -->
98+
<svg class="octicon octicon-info" style="fill:currentColor" 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>
8099
</span>
81-
<span class="Toast-content">Submitting issue to <strong>github/github. </strong><a href="#">Try again.</a></span>
82-
<a class="Toast-dismiss"><svg class="octicon octicon-x" viewBox="0 0 12 16" version="1.1" width="12" height="16" role="img"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48L7.48 8z"></path></svg></a>
100+
<span class="Toast-content">This toast is dismissable.</span>
101+
<button class="Toast-dismissButton">
102+
<svg class="octicon octicon-x" style="fill:currentcolor" viewBox="0 0 12 16" version="1.1" width="12" height="16" role="img"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48L7.48 8z"></path></svg>
103+
</button>
83104
</div>
84105
</div>
85106
```
86107

87-
## Toast animating
108+
## Toast with link
109+
110+
Include a link to allow users to take actions within a Toast.
88111

89-
```html title="Toast animating"
90-
<div class="p-3">
91-
<div class="Toast Toast-animated Toast-block-error">
92-
<span class="Toast-octicon">
93-
<svg class="octicon octicon-alert" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"></path></svg>
112+
```html title="Toast with link"
113+
<div class="p-1">
114+
<div class="Toast">
115+
<span class="Toast-icon">
116+
<!-- <%= octicon "info" %> -->
117+
<svg class="octicon octicon-info" style="fill:currentColor" 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>
94118
</span>
95-
<span class="Toast-content">Submitting issue to <strong>github/github</strong></span>
119+
<span class="Toast-content">Toast message goes here </strong><a href="#">Action.</a></span>
96120
</div>
97121
</div>
98122
```
99123

100-
## Toast with long text
124+
## Toast animation
101125

102-
```html title="Toast with long text"
103-
<div class="p-3">
104-
<div class="Toast Toast-block-error">
105-
<span class="Toast-octicon">
106-
<svg class="octicon octicon-alert" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"></path></svg>
126+
The `Toast--animateIn` and `Toast--animateOut` modifier classes can be used to animate the toast in and out from the bottom.
127+
128+
```html title="Toast animating"
129+
<div class="p-1">
130+
<div class="Toast Toast--animateIn">
131+
<span class="Toast-icon">
132+
<!-- <%= octicon "info" %> -->
133+
<svg class="octicon octicon-info" style="fill:currentColor" 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>
107134
</span>
108-
<span class="Toast-content">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</a></span>
135+
<span class="Toast-content">Toast message goes here.</span>
109136
</div>
110137
</div>
111138
```
112139

113-
## Toast with long text and a dismiss
140+
## Toast position
114141

115-
```html title="Toast with long text"
116-
<div class="p-3">
117-
<div class="Toast Toast-block-error">
118-
<span class="Toast-octicon">
119-
<svg class="octicon octicon-alert" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"></path></svg>
120-
</span>
121-
<span class="Toast-content">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</a></span>
122-
<a class="Toast-dismiss"><svg class="octicon octicon-x" viewBox="0 0 12 16" version="1.1" width="12" height="16" role="img"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48L7.48 8z"></path></svg></a>
142+
Use the `position-fixed bottom-0` utility classes on a wrapper element to position Toasts at the **bottom left** of the viewport.
143+
144+
```html title="Toast animating"
145+
<div class="border bg-gray-light" style="height:150px">
146+
<div class="position-fixed bottom-0">
147+
<div class="Toast">
148+
<span class="Toast-icon">
149+
<!-- <%= octicon "info" %> -->
150+
<svg class="octicon octicon-info" style="fill:currentColor" 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>
151+
</span>
152+
<span class="Toast-content">Toast message goes here.</span>
153+
</div>
123154
</div>
124155
</div>
125156
```

src/toasts/toasts.scss

Lines changed: 49 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,89 @@
11
// Toast
22

3-
// just for the documentation, remove before shipping
4-
.Toast-wrapper {
5-
padding: 30px;
6-
}
7-
83
.Toast {
94
display: flex;
10-
background-color: white;
5+
margin: $spacer-2;
116
color: $black;
12-
padding: $spacer-3;
7+
background-color: $bg-white;
138
border-radius: $border-radius;
149
box-shadow: inset 0 0 0 1px $border-gray-dark, $box-shadow-medium;
15-
margin: $spacer-2;
16-
transition: 0.2s ease;
1710

1811
@include breakpoint(sm) {
19-
max-width: 450px;
2012
width: max-content;
13+
max-width: 450px;
2114
margin: $spacer-3;
2215
}
2316
}
2417

25-
.Toast-octicon {
26-
margin-right: $spacer-2;
18+
.Toast-icon {
2719
display: flex;
2820
align-items: center;
21+
justify-content: center;
22+
width: $spacer-3 * 3;
23+
flex-shrink: 0;
24+
color: $text-white;
25+
background-color: $blue-500;
26+
border-top-left-radius: inherit;
27+
border-bottom-left-radius: inherit;
2928
}
3029

31-
32-
// Temporarily splitting this out
33-
// to play with static styles.
34-
.Toast-animated {
35-
position: fixed;
36-
bottom: -100px;
37-
left: 0;
38-
animation-name: toast;
39-
animation-duration: 6s;
40-
animation-delay: 1s;
41-
animation-iteration-count: 1;
42-
animation-timing-function: cubic-bezier(0.645, 0.045, 0.355, 1);
30+
.Toast-content {
31+
padding: $spacer-3;
4332
}
4433

45-
// Pop up animation
46-
@keyframes toast {
47-
0% {bottom:-100px;}
48-
10% {bottom:0px;}
49-
90% {bottom:0px;}
50-
100% {bottom:-100px;}
51-
}
34+
.Toast-dismissButton {
35+
max-height: 54px; // keeps button aligned to the top
36+
padding: $spacer-3;
37+
background-color: transparent;
38+
border: 0;
5239

53-
.Toast-block-default,
54-
.Toast-block-error,
55-
.Toast-block-warning,
56-
.Toast-block-success {
57-
padding: 0;
58-
59-
.Toast-octicon {
60-
color: white;
61-
padding: $spacer-3;
62-
margin-right: 0;
63-
fill: white;
64-
border-top-left-radius: inherit;
65-
border-bottom-left-radius: inherit;
40+
&:focus,
41+
&:hover {
42+
color: $text-gray;
43+
outline: none;
6644
}
6745

68-
.Toast-content {
69-
padding: $spacer-3;
46+
&:active {
47+
color: $gray-400;
7048
}
49+
}
7150

72-
.Toast-dismiss {
73-
padding: $spacer-3;
74-
align-self: center;
51+
// Modifier
7552

76-
&:hover {
77-
cursor: pointer;
78-
fill: $text-gray;
79-
}
80-
}
53+
.Toast--error .Toast-icon {
54+
background-color: $red-500;
8155
}
8256

83-
.Toast-block-default {
57+
.Toast--warning .Toast-icon {
58+
color: $gray-900;
59+
background-color: $yellow-600;
60+
}
8461

85-
.Toast-octicon {
86-
background-color: $blue-500;
87-
}
62+
.Toast--success .Toast-icon {
63+
background-color: $green-500;
8864
}
8965

90-
.Toast-block-error {
66+
// Animations
9167

92-
.Toast-octicon {
93-
background-color: $red-500;
94-
}
68+
.Toast--animateIn {
69+
animation: Toast--animateIn 0.18s cubic-bezier(0.22, 0.61, 0.36, 1) backwards;
9570
}
9671

97-
.Toast-block-warning {
98-
99-
.Toast-octicon {
100-
background-color: $yellow-600;
101-
fill: $gray-900;
72+
@keyframes Toast--animateIn {
73+
0% {
74+
opacity: 0;
75+
transform: translateY(100%);
10276
}
10377
}
10478

105-
.Toast-block-success {
79+
.Toast--animateOut {
80+
animation: Toast--animateOut 0.18s cubic-bezier(0.55, 0.06, 0.68, 0.19) forwards;
81+
}
10682

107-
.Toast-octicon {
108-
background-color: $green-500;
83+
@keyframes Toast--animateOut {
84+
100% {
85+
pointer-events: none;
86+
opacity: 0;
87+
transform: translateY(100%);
10988
}
11089
}

0 commit comments

Comments
 (0)