neiam
/apollos_crib
It's Apollo's Crib
public · Issues · Pulls 1 · Labels · Forks · Compare · Actions failure · Badges · Packages
⭐
Log in to mark this repository.
make all the boxes have a gitlab too
25b9ed1 · gmorell · 2024-02-10 06:44
Files changed
modified
apps/room_sanctum/lib/room_sanctum_web/components/core_components.ex
+51
−0
@@ -275,6 +275,7 @@ defmodule RoomSanctumWeb.CoreComponents do
| 275 | 275 | attr :options, :list, doc: "the options to pass to Phoenix.HTML.Form.options_for_select/2" |
| 276 | 276 | attr :multiple, :boolean, default: false, doc: "the multiple flag for select inputs" |
| 277 | 277 | |
| 278 | + attr :checked_value, :string, doc: "the currently checked value" | |
| 278 | 279 | attr :rest, :global, |
| 279 | 280 | include: ~w(accept autocomplete capture cols disabled form list max maxlength min minlength |
| 280 | 281 | multiple pattern placeholder readonly required rows size step) |
@@ -353,6 +354,56 @@ defmodule RoomSanctumWeb.CoreComponents do
| 353 | 354 | """ |
| 354 | 355 | end |
| 355 | 356 | |
| 357 | + # checked={(@checked_value == opt) || (@field.value == String.to_atom(opt))} | |
| 358 | + | |
| 359 | + | |
| 360 | + def input(%{type: "radio"} = assigns) do | |
| 361 | + ~H""" | |
| 362 | + <div phx-feedback-for={@name}> | |
| 363 | + <fieldset> | |
| 364 | + <div class="grid grid-cols-3"> | |
| 365 | + <%= for opt <- @options do %> | |
| 366 | + <input | |
| 367 | + field={@field} | |
| 368 | + label={opt} | |
| 369 | + type={@type} | |
| 370 | + name={@id} | |
| 371 | + id={"#{@id}_#{opt}"} | |
| 372 | + value={opt} | |
| 373 | + class={[ | |
| 374 | + "mt-2 radio sm:leading-6", | |
| 375 | + "phx-no-feedback:border-zinc-300 phx-no-feedback:focus:border-zinc-400", | |
| 376 | + @errors == [] && "border-zinc-300 focus:border-zinc-400", | |
| 377 | + @errors != [] && "border-rose-400 focus:border-rose-400", | |
| 378 | + "bg-#{opt}-500 checked:bg-#{opt}-500 checked:hover:bg-#{opt}-500" | |
| 379 | + ]} | |
| 380 | + | |
| 381 | + {@rest} | |
| 382 | + /> | |
| 383 | + <% end %> | |
| 384 | + </div> | |
| 385 | + <input | |
| 386 | + field={@field} | |
| 387 | + type={@type} | |
| 388 | + name={@id <> @label} | |
| 389 | + id={@id <> "None"} | |
| 390 | + value={nil} | |
| 391 | + class={[ | |
| 392 | + "mt-2 radio sm:leading-6 w-full", | |
| 393 | + "phx-no-feedback:border-zinc-300 phx-no-feedback:focus:border-zinc-400", | |
| 394 | + @errors == [] && "border-zinc-300 focus:border-zinc-400", | |
| 395 | + @errors != [] && "border-rose-400 focus:border-rose-400", | |
| 396 | + "bg-stone-950 checked:bg-stone-950", | |
| 397 | + ]} | |
| 398 | + {@rest} | |
| 399 | + /> | |
| 400 | + </fieldset> | |
| 401 | + | |
| 402 | + <.error :for={msg <- @errors}><%= msg %></.error> | |
| 403 | + </div> | |
| 404 | + """ | |
| 405 | + end | |
| 406 | + | |
| 356 | 407 | def input(%{lb_a: action, lb_i: icon, lb_tgt: tgt} = assigns) do |
| 357 | 408 | ~H""" |
| 358 | 409 | <div phx-feedback-for={@name}> |
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_pythiae_live/public.html.heex
+1
−0
@@ -16,6 +16,7 @@
| 16 | 16 | <% {_, :ephem} -> %> <.p_ephem entries={condense(k, p) |> preview(k)}> </.p_ephem> |
| 17 | 17 | <% {_, :calendar} -> %> <.p_calendar entries={condense(k, p) |> preview(k)}> </.p_calendar> |
| 18 | 18 | <% {_, :cronos} -> %> <.p_cronos entries={condense(k, p) |> preview(k)}> </.p_cronos> |
| 19 | + <% {_, :gitlab} -> %> <.p_gitlab entries={condense(k, p) |> preview(k)}> </.p_gitlab> | |
| 19 | 20 | <% end %> |
| 20 | 21 | </div> |
| 21 | 22 | </div> |
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_pythiae_live/show.html.heex
+1
−0
@@ -107,6 +107,7 @@
| 107 | 107 | <% {_, :ephem} -> %> <.p_ephem entries={condense(k, p) |> preview(k)}> </.p_ephem> |
| 108 | 108 | <% {_, :calendar} -> %> <.p_calendar entries={condense(k, p) |> preview(k)}> </.p_calendar> |
| 109 | 109 | <% {_, :cronos} -> %> <.p_cronos entries={condense(k, p) |> preview(k)}> </.p_cronos> |
| 110 | + <% {_, :gitlab} -> %> <.p_gitlab entries={condense(k, p) |> preview(k)}> </.p_gitlab> | |
| 110 | 111 | <% end %> |
| 111 | 112 | </div> |
| 112 | 113 | </div> |
modified
apps/room_sanctum/lib/room_sanctum_web/live/landing_live/index.html.heex
+2
−0
@@ -45,6 +45,8 @@
| 45 | 45 | <% {_, :aqi} -> %> <.p_aqi entries={condense(k, p) |> preview(k)}> </.p_aqi> |
| 46 | 46 | <% {_, :ephem} -> %> <.p_ephem entries={condense(k, p) |> preview(k)}> </.p_ephem> |
| 47 | 47 | <% {_, :calendar} -> %> <.p_calendar entries={condense(k, p) |> preview(k)}> </.p_calendar> |
| 48 | + <% {_, :cronos} -> %> <.p_cronos entries={condense(k, p) |> preview(k)}> </.p_cronos> | |
| 49 | + <% {_, :gitlab} -> %> <.p_gitlab entries={condense(k, p) |> preview(k)}> </.p_gitlab> | |
| 48 | 50 | <% end %> |
| 49 | 51 | |
| 50 | 52 | </div> |
Parents: 66d0fc6