From 0d51a1ccbdebd9bf9c031c32ee0558e99ea2cad5 Mon Sep 17 00:00:00 2001 From: Kieran Eglin Date: Thu, 15 Feb 2024 10:54:21 -0800 Subject: [PATCH] Finally fixed flash messages --- .../components/core_components.ex | 53 +++++++++++-------- .../media/media_item_html/show.html.heex | 11 ++++ 2 files changed, 42 insertions(+), 22 deletions(-) diff --git a/lib/pinchflat_web/components/core_components.ex b/lib/pinchflat_web/components/core_components.ex index 5c7c073..bcf8e02 100644 --- a/lib/pinchflat_web/components/core_components.ex +++ b/lib/pinchflat_web/components/core_components.ex @@ -112,24 +112,29 @@ defmodule PinchflatWeb.CoreComponents do
hide("##{@id}")} + class="pb-8" role="alert" - class={[ - "fixed top-2 right-2 mr-2 w-80 sm:w-96 z-50 rounded-lg p-3 ring-1", - @kind == :info && "bg-emerald-50 text-emerald-800 ring-emerald-500 fill-cyan-900", - @kind == :error && "bg-rose-50 text-rose-900 shadow-md ring-rose-500 fill-rose-900" - ]} {@rest} > -

- <.icon :if={@kind == :info} name="hero-information-circle-mini" class="h-4 w-4" /> - <.icon :if={@kind == :error} name="hero-exclamation-circle-mini" class="h-4 w-4" /> - <%= @title %> -

-

<%= msg %>

- +
+
+
+ <%= @title %> +
+

<%= msg %>

+
+ +
""" end @@ -146,7 +151,7 @@ defmodule PinchflatWeb.CoreComponents do def flash_group(assigns) do ~H""" -
+
<.flash kind={:info} title="Success!" flash={@flash} /> <.flash kind={:error} title="Error!" flash={@flash} /> <.flash @@ -632,9 +637,11 @@ defmodule PinchflatWeb.CoreComponents do def show(js \\ %JS{}, selector) do JS.show(js, to: selector, - transition: - {"transition-all transform ease-out duration-300", "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95", - "opacity-100 translate-y-0 sm:scale-100"} + transition: { + "transition-all transform ease-out duration-300", + "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95", + "opacity-100 translate-y-0 sm:scale-100" + } ) end @@ -642,9 +649,11 @@ defmodule PinchflatWeb.CoreComponents do JS.hide(js, to: selector, time: 200, - transition: - {"transition-all transform ease-in duration-200", "opacity-100 translate-y-0 sm:scale-100", - "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"} + transition: { + "transition-all transform ease-in duration-200", + "opacity-100 translate-y-0 sm:scale-100", + "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" + } ) end diff --git a/lib/pinchflat_web/controllers/media/media_item_html/show.html.heex b/lib/pinchflat_web/controllers/media/media_item_html/show.html.heex index 48db176..f23de2c 100644 --- a/lib/pinchflat_web/controllers/media/media_item_html/show.html.heex +++ b/lib/pinchflat_web/controllers/media/media_item_html/show.html.heex @@ -7,6 +7,17 @@ Media Item #<%= @media_item.id %>
+