diff --git a/assets/tailwind.config.js b/assets/tailwind.config.js index 15c790c..72a4851 100644 --- a/assets/tailwind.config.js +++ b/assets/tailwind.config.js @@ -26,6 +26,10 @@ module.exports = { light: '#64D9ED', dark: '#324B77', }, + selected: { + light: '#6CBDEE', + dark: '#5376B3', + }, }, }, }, diff --git a/lib/labelmaker_web/constants.ex b/lib/labelmaker_web/constants.ex index 6ecd839..885e61c 100644 --- a/lib/labelmaker_web/constants.ex +++ b/lib/labelmaker_web/constants.ex @@ -24,6 +24,12 @@ defmodule LabelmakerWeb.Constants do |> Enum.map(&Atom.to_string/1) @alignments [ + "left", + "center", + "right" + ] + + @gravity [ "west", "center", "east" @@ -92,6 +98,7 @@ defmodule LabelmakerWeb.Constants do def max_label_error, do: @max_label_error def outlines, do: ["none" | @colors] def permitted_alignments, do: @alignments + def permitted_gravity, do: @gravity def permitted_keys, do: @permitted_keys def preview, do: @preview def sizes, do: @sizes diff --git a/lib/labelmaker_web/live/components/radio_component.ex b/lib/labelmaker_web/live/components/radio_component.ex new file mode 100644 index 0000000..f7f2135 --- /dev/null +++ b/lib/labelmaker_web/live/components/radio_component.ex @@ -0,0 +1,46 @@ +defmodule LabelmakerWeb.RadioComponent do + use Phoenix.Component + + # props: class, is_dm, settings, options + attr :class, :string, default: "" + attr :selected, :string, required: true + attr :options, :list, required: true + + # class="mt-1 block w-full rounded border border-gray-300 px-3 py-2 bg-secondary-light text-fg-light dark:bg-secondary-dark dark:text-fg-dark dark:border-gray-600 focus:ring-primary" + + def radio_component(assigns) do + ~H""" +
+ """ + end +end diff --git a/lib/labelmaker_web/live/home.ex b/lib/labelmaker_web/live/home.ex index 9a7b729..4e4b496 100644 --- a/lib/labelmaker_web/live/home.ex +++ b/lib/labelmaker_web/live/home.ex @@ -1,5 +1,6 @@ defmodule LabelmakerWeb.Home do use LabelmakerWeb, :live_view + import LabelmakerWeb.RadioComponent alias LabelmakerWeb.Constants alias LabelmakerWeb.Tools diff --git a/lib/labelmaker_web/live/home.html.heex b/lib/labelmaker_web/live/home.html.heex index a237ba8..2d25f6a 100644 --- a/lib/labelmaker_web/live/home.html.heex +++ b/lib/labelmaker_web/live/home.html.heex @@ -148,6 +148,8 @@ /> + + <.radio_component options={Constants.permitted_alignments()} selected={@align} />