Skip to content

Commit 83b4b5e

Browse files
committed
Add styling to flash messages & use Alpine.js
1 parent dc153b1 commit 83b4b5e

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

resources/views/layouts/app.blade.php

+19-2
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,26 @@
77
<meta http-equiv="X-UA-Compatible" content="ie=edge">
88
<title>Laravel 10 Task List App</title>
99
<script src="https://cdn.tailwindcss.com"></script>
10+
<script src="//unpkg.com/alpinejs" defer></script>
11+
1012
<style type="text/tailwindcss">
1113
.btn {
1214
@apply rounded-md px-2 py-1 text-center font-medium shadow-sm ring-1 ring-slate-700/10 hover:bg-slate-50 text-slate-700
1315
}
16+
1417
.link {
1518
@apply font-medium text-gray-700 underline decoration-pink-500
1619
}
20+
1721
label {
1822
@apply block uppercase text-slate-700 mb-2
1923
}
24+
2025
input,
2126
textarea {
2227
@apply shadow-sm appearance-none border w-full py-2 px-3 text-slate-700 leading-tight focus:outline-none
2328
}
29+
2430
.error {
2531
@apply text-red-500 text-sm
2632
}
@@ -30,12 +36,23 @@
3036

3137
<body class="container mx-auto mt-10 mb-10 max-w-lg">
3238
<h1 class="text-2xl mb-4">@yield('title')</h1>
33-
<div>
39+
<di x-data="{ flash: true }">
3440
@if (session()->has('success'))
41+
<div x-show="flash"
42+
class="relative mb-10 rounded border border-green-400 bg-green-100 px-4 py-3 text-lg text-green-700"
43+
role="alert">
44+
<strong class="font-bold">Success!</strong>
3545
<div>{{ session('success') }}</div>
46+
<span class="absolute top-0 bottom-0 right-0 px-4 py-3">
47+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
48+
@click="flash = false" stroke="currentColor" class="h-6 w-6 cursor-pointer">
49+
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
50+
</svg>
51+
</span>
52+
</div>
3653
@endif
3754
@yield('content')
38-
</div>
55+
</div>
3956
</body>
4057

4158
</html>

0 commit comments

Comments
 (0)