diff --git a/assets/css/app.css b/assets/css/app.css index aa6f8047..01de7059 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -276,21 +276,12 @@ } .btn { - @apply btn-sm; @apply transition-transform duration-200; border-radius: 0.75rem; border: none; box-shadow: none; } - .btn-ghost { - background: transparent !important; - } - - .btn-ghost:hover { - background: color-mix(in oklch, var(--color-base-content) 6%, transparent) !important; - } - .btn:hover:not(:disabled):not(.btn-ghost) { transform: scale(1.01); } diff --git a/docs/guides/coding/uiux.md b/docs/guides/coding/uiux.md index 17384e43..b3f48e84 100644 --- a/docs/guides/coding/uiux.md +++ b/docs/guides/coding/uiux.md @@ -28,6 +28,9 @@ Do not put framework-specific implementation details here. - default: `outline` - save/submit: `primary` or `accent` - destructive: `error` +- `<.button>` variant is the semantic source of truth for button type (`submit` / `ghost` / `outline` / `danger`). +- Do not mix conflicting semantic style classes on `<.button>` calls (for example `variant=\"ghost\"` with `btn-outline`, or `variant=\"outline\"` with `btn-ghost`). +- Visual fine-tuning beyond semantic variant should use daisyUI utility classes/CSS (size, spacing, positioning, z-index, visibility, layout), not override semantic type. - `cancel` should use `ghost`. - `save/submit` should use `primary`. - Do not place destructive actions (for example `delete`) in the primary bottom action row. diff --git a/lib/vmemo_web/components/core_components.ex b/lib/vmemo_web/components/core_components.ex index e6caa88d..52b931d5 100644 --- a/lib/vmemo_web/components/core_components.ex +++ b/lib/vmemo_web/components/core_components.ex @@ -374,7 +374,7 @@ defmodule VmemoWeb.CoreComponents do <.button phx-click="go" class="ml-2">Send! """ - attr :variant, :string, default: "submit", values: ~w(submit ghost danger outline) + attr :variant, :string, default: nil, values: [nil | ~w(submit ghost danger outline)] attr :size, :string, default: nil, values: [nil | ~w(xs sm lg)] attr :class, :string, default: nil attr :rest, :global, include: ~w(disabled form name value type ) diff --git a/lib/vmemo_web/live/components/search_box.ex b/lib/vmemo_web/live/components/search_box.ex index 101c9a72..aabad193 100644 --- a/lib/vmemo_web/live/components/search_box.ex +++ b/lib/vmemo_web/live/components/search_box.ex @@ -350,11 +350,12 @@ defmodule VmemoWeb.LiveComponents.SearchBox do <%= if entry.progress == 0 do %> <.button type="button" + size="sm" phx-target={@myself} phx-click="cancel-image" phx-value-ref={entry.ref} aria-label="cancel" - class="absolute top-2 right-2 btn btn-circle btn-sm btn-neutral z-10" + class="absolute top-2 right-2 btn-circle z-10" > × diff --git a/lib/vmemo_web/live/image_id_live.ex b/lib/vmemo_web/live/image_id_live.ex index bdd2827b..5de03768 100644 --- a/lib/vmemo_web/live/image_id_live.ex +++ b/lib/vmemo_web/live/image_id_live.ex @@ -304,10 +304,10 @@ defmodule VmemoWeb.ImageIdLive do <.button - variant="outline" + size="sm" phx-click="show-expanded" aria-label={gettext("expand")} - class="absolute top-2 right-2 btn-circle hidden group-hover:hidden sm:group-hover:flex items-center justify-center group-hover:bg-base-100" + class="absolute top-3 right-3 btn-circle hidden group-hover:hidden sm:group-hover:inline-flex items-center justify-center" > <.icon name="hero-arrows-pointing-out" class="h-4 w-4" /> @@ -378,7 +378,7 @@ defmodule VmemoWeb.ImageIdLive do id={@form[:caption].id} name={@form[:caption].name} class={[ - "textarea textarea-bordered w-full rounded-lg pr-12", + "textarea textarea-bordered w-full rounded-lg pr-14", if(@latest_caption_request, do: @latest_caption_request.status == "pending" || @@ -394,10 +394,12 @@ defmodule VmemoWeb.ImageIdLive do else: false } >{Phoenix.HTML.Form.normalize_value("textarea", @form[:caption].value)} - + <.error :for={msg <- @form[:caption].errors}> @@ -521,7 +523,7 @@ defmodule VmemoWeb.ImageIdLive do /> <.button phx-click="rotate-image" - class="btn btn-circle bg-white text-black hover:bg-white border border-zinc-200 !shadow-none" + class="btn-circle bg-white text-black hover:bg-white border border-zinc-200 !shadow-none" aria-label={gettext("Rotate and save")} title={gettext("Rotate and save")} >