Files
Claper/lib/claper_web/views/components/alert_component.ex
Alex Lion 9c1c3d01c1 deps: upgrade to tailwind 4+
commit e5905358dc20cea2fcc41b3580c4985e8ac53217
Author: Alex Lion <dev@alexandrelion.com>
Date:   Mon Jul 7 22:56:14 2025 +0200

    chore: update changelog

commit 2696a29ffdc6deb930b8ffb6f92cae21b176e853
Author: Alex Lion <dev@alexandrelion.com>
Date:   Mon Jul 7 22:52:11 2025 +0200

    Change js file to css and migrate css classes

commit 19093360ed2404f956d799c0a9ec1656c9fa1a74
Author: Alex Lion <dev@alexandrelion.com>
Date:   Sat Jul 5 19:28:34 2025 +0200

    chore: upgrade to tailwind 4+

commit 75312e8b3d3c9fd25137189e7020994640a0f901
Author: Alex Lion <dev@alexandrelion.com>
Date:   Thu Jul 3 16:59:58 2025 +0200

    chore: remove useless files
2025-07-07 23:00:30 +02:00

83 lines
2.4 KiB
Elixir

defmodule ClaperWeb.Component.Alert do
use ClaperWeb, :view_component
def info(assigns) do
assigns =
assigns
|> assign_new(:stick, fn -> false end)
~H"""
<div
class="bg-supporting-green-50 border-t-4 rounded-b-md shadow-md border-supporting-green-400 p-4 mb-3"
x-data="{ open: true }"
x-show={if @stick, do: "true", else: "open"}
x-init="setTimeout(() => {open = false}, 4000)"
x-transition
>
<div class="flex">
<div class="shrink-0">
<svg
class="h-5 w-5 text-green-400"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
fill="currentColor"
aria-hidden="true"
>
<path
fill-rule="evenodd"
d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
clip-rule="evenodd"
/>
</svg>
</div>
<div class="ml-3">
<p class="text-sm text-supporting-green-700">
{@message}
</p>
</div>
</div>
</div>
"""
end
def error(assigns) do
assigns =
assigns
|> assign_new(:stick, fn -> false end)
~H"""
<div
class="bg-supporting-red-50 border-t-4 rounded-b-md shadow-md border-supporting-red-400 p-4 mb-3"
x-data="{ open: true }"
x-show={if @stick, do: "true", else: "open"}
x-init="setTimeout(() => {open = false}, 4000)"
x-transition
>
<div class="flex">
<div class="shrink-0">
<!-- Heroicon name: solid/exclamation -->
<svg
class="h-5 w-5 text-supporting-red-400"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
fill="currentColor"
aria-hidden="true"
>
<path
fill-rule="evenodd"
d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z"
clip-rule="evenodd"
/>
</svg>
</div>
<div class="ml-3">
<p class="text-sm text-supporting-red-700">
{@message}
</p>
</div>
</div>
</div>
"""
end
end