From b9af7249441bcdb2d9d25201370e85198fa26894 Mon Sep 17 00:00:00 2001 From: Jamil Date: Tue, 23 Jul 2024 22:19:33 -0700 Subject: [PATCH] fix(ux): Improve resource creation form and traffic filters (#5983) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Adds `radio_button_group` to style radio buttons as big buttons - Tweaks `inline_errors` so that `w-full` doesn't apply; this fixes the input width from jumping when errors pop up - Fixes #4979 - Fixes #5239 Screenshot 2024-07-23 at 5 45 12 PM --- .../web/lib/web/components/core_components.ex | 6 +- .../web/lib/web/components/form_components.ex | 40 ++++- .../web/lib/web/live/resources/components.ex | 159 +++++++++--------- elixir/apps/web/lib/web/live/resources/new.ex | 76 +++++++-- 4 files changed, 175 insertions(+), 106 deletions(-) diff --git a/elixir/apps/web/lib/web/components/core_components.ex b/elixir/apps/web/lib/web/components/core_components.ex index 938eb2ff3..10d09f315 100644 --- a/elixir/apps/web/lib/web/components/core_components.ex +++ b/elixir/apps/web/lib/web/components/core_components.ex @@ -360,13 +360,13 @@ defmodule Web.CoreComponents do ~H"""

- <.icon name="hero-exclamation-circle-mini" class="mt-0.5 h-5 w-5 flex-none" /> + <.icon name="hero-exclamation-circle-mini" class="h-4 w-4 flex-none" /> <%= render_slot(@inner_block) %>

""" diff --git a/elixir/apps/web/lib/web/components/form_components.ex b/elixir/apps/web/lib/web/components/form_components.ex index 03568dec9..d7d911ceb 100644 --- a/elixir/apps/web/lib/web/components/form_components.ex +++ b/elixir/apps/web/lib/web/components/form_components.ex @@ -32,8 +32,9 @@ defmodule Web.FormComponents do attr :type, :string, default: "text", - values: ~w(checkbox color date datetime-local email file hidden month number password - range radio readonly search group_select select tel text textarea time url week) + values: + ~w(checkbox color date datetime-local email file hidden month number password + range radio radio_button_group readonly search group_select select tel text textarea time url week) attr :field, Phoenix.HTML.FormField, doc: "a form field struct retrieved from the form, for example: @form[:email]" @@ -97,7 +98,8 @@ defmodule Web.FormComponents do |> input() end - def input(%{type: "radio"} = assigns) do + # radio with label + def input(%{type: "radio", label: _label} = assigns) do ~H"""