text alignment for widthxheight images

This commit is contained in:
Gavin McDonald
2025-08-24 11:13:18 -04:00
parent 3ab19e01fd
commit a981cf98d7
6 changed files with 69 additions and 60 deletions

View File

@@ -19,18 +19,6 @@ defmodule LabelmakerWeb.Home do
}
end
def handle_event("update_preview", %{"bg" => bg}, socket) do
preview_background =
case bg do
"r" -> "bg-[linear-gradient(to_right,_black_33%,_white_67%)]"
"b" -> "bg-[linear-gradient(to_bottom,_black_33%,_white_67%)]"
"c" -> ""
_ -> "bg-[linear-gradient(to_right,_black_33%,_white_67%)]"
end
{:noreply, assign(socket, :preview_background, preview_background)}
end
def handle_event("update_label", params, socket) do
assigns =
socket.assigns
@@ -43,6 +31,22 @@ defmodule LabelmakerWeb.Home do
{:noreply, assign(socket, assigns)}
end
def handle_event("update_preview", %{"bg" => bg}, socket) do
preview_background =
case bg do
"r" -> "bg-[linear-gradient(to_right,_black_33%,_white_67%)]"
"b" -> "bg-[linear-gradient(to_bottom,_black_33%,_white_67%)]"
"c" -> ""
_ -> "bg-[linear-gradient(to_right,_black_33%,_white_67%)]"
end
{:noreply, assign(socket, :preview_background, preview_background)}
end
def handle_event("update_alignment", %{"option" => option}, socket) do
{:noreply, assign(socket, :align, option)}
end
def handle_event("make_label", params, socket) do
{:noreply, redirect(socket, to: ~p"/#{params["label"]}?#{Map.drop(params, ["label"])}")}
end