Skip to content

Commit c4ac81a

Browse files
author
Lewis Youl
committed
wip: use new toast message
1 parent a40aaa1 commit c4ac81a

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

app/views/layouts/application.html.erb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
</head>
3131

3232
<body>
33-
<%= render partial: 'shared/toast' %>
3433
<%= render partial: 'shared/topbar' %>
34+
<!-- This example requires Tailwind CSS v2.0+ -->
3535

3636
<div class="max-w-6xl mx-auto py-4 md:px-4 lg:px-8">
3737
<div class="min-h-screen bg-gray-100">
@@ -47,5 +47,6 @@
4747
</div>
4848
</div>
4949

50+
<%= render partial: 'shared/toast' %>
5051
</body>
5152
</html>

app/views/shared/_toast.html.erb

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,37 @@
1+
2+
13
<div
4+
class="z-20 fixed bottom-0 left-0 right-0 mx-auto mb-4 max-w-sm w-full bg-white shadow-lg rounded-lg pointer-events-auto ring-1 ring-black ring-opacity-5 overflow-hidden hidden"
25
id="toast"
3-
class="toast--container-notice hidden"
4-
data-toast-notice-class="toast--container-notice"
5-
data-toast-alert-class="toast--container-alert"
6+
data-toast-notice-class="''"
7+
data-toast-alert-class="''"
68
data-controller="toast"
79
data-toast-target="toast"
810
data-toast-notice="<%= notice %>"
911
data-toast-alert="<%= alert %>"
1012
>
11-
<span data-toast-target="message"></span>
13+
<div class="p-4">
14+
<div class="flex items-start">
15+
<div class="flex-shrink-0">
16+
<!-- Heroicon name: outline/check-circle -->
17+
<svg class="h-6 w-6 text-green-400" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
18+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
19+
</svg>
20+
</div>
21+
<div class="ml-3 w-0 flex-1 pt-0.5">
22+
<p class="text-sm font-medium text-gray-900" data-toast-target="message">
23+
Successfully saved!
24+
</p>
25+
</div>
26+
<div class="ml-4 flex-shrink-0 flex">
27+
<button class="bg-white rounded-md inline-flex text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
28+
<span class="sr-only">Close</span>
29+
<!-- Heroicon name: solid/x -->
30+
<svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
31+
<path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd" />
32+
</svg>
33+
</button>
34+
</div>
35+
</div>
36+
</div>
1237
</div>

0 commit comments

Comments
 (0)