From 5a01624f032c82e72fe7c8c2ae62bb99f9b1e147 Mon Sep 17 00:00:00 2001 From: hq1 Date: Wed, 13 Dec 2023 15:58:21 +0100 Subject: [PATCH] Fix link styling regression introduced via #3572 (#3629) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix link styling regression introduced via #3572 * Justify external links in user dropdown * Format * Use assigns.new_tab to justify justification 🤡 --- lib/plausible_web/components/generic.ex | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/plausible_web/components/generic.ex b/lib/plausible_web/components/generic.ex index bc595fe60..ff932fc14 100644 --- a/lib/plausible_web/components/generic.ex +++ b/lib/plausible_web/components/generic.ex @@ -194,14 +194,20 @@ defmodule PlausibleWeb.Components.Generic do slot :inner_block, required: true def dropdown_link(assigns) do + class = + "w-full inline-flex text-gray-700 dark:text-gray-300 px-3.5 py-1.5 hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-900 dark:hover:text-gray-100" + + class = + if assigns.new_tab do + "#{class} justify-between" + else + class + end + + assigns = assign(assigns, :class, class) + ~H""" - <.unstyled_link - new_tab={@new_tab} - href={@href} - x-on:click="close()" - class="w-full inline-flex text-gray-700 dark:text-gray-300 px-3.5 py-1.5 hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-900 dark:hover:text-gray-100" - {@rest} - > + <.unstyled_link new_tab={@new_tab} href={@href} x-on:click="close()" class={@class} {@rest}> <%= render_slot(@inner_block) %> """ @@ -222,7 +228,7 @@ defmodule PlausibleWeb.Components.Generic do <.link id={@id} class={[ - "justify-between items-center gap-x-0.5", + "inline-flex items-center gap-x-0.5", @class ]} href={@href}