Update core components for forms to add dark theme.
simple_form, input, label, header to implement dark theme.
This commit is contained in:
@@ -265,7 +265,7 @@ defmodule DecentralisedBookIndexWeb.CoreComponents do
|
|||||||
def simple_form(assigns) do
|
def simple_form(assigns) do
|
||||||
~H"""
|
~H"""
|
||||||
<.form :let={f} for={@for} as={@as} {@rest}>
|
<.form :let={f} for={@for} as={@as} {@rest}>
|
||||||
<div class="mt-10 space-y-8 bg-white">
|
<div class="mt-10 space-y-8 bg-white dark:bg-gray-900">
|
||||||
{render_slot(@inner_block, f)}
|
{render_slot(@inner_block, f)}
|
||||||
<div :for={action <- @actions} class="mt-2 flex items-center justify-between gap-6">
|
<div :for={action <- @actions} class="mt-2 flex items-center justify-between gap-6">
|
||||||
{render_slot(action, f)}
|
{render_slot(action, f)}
|
||||||
@@ -373,7 +373,7 @@ defmodule DecentralisedBookIndexWeb.CoreComponents do
|
|||||||
|
|
||||||
~H"""
|
~H"""
|
||||||
<div>
|
<div>
|
||||||
<label class="flex items-center gap-4 text-sm leading-6 text-zinc-600">
|
<label class="flex items-center gap-4 text-sm leading-6 text-zinc-600 dark:text-white">
|
||||||
<input type="hidden" name={@name} value="false" disabled={@rest[:disabled]} />
|
<input type="hidden" name={@name} value="false" disabled={@rest[:disabled]} />
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
@@ -381,7 +381,7 @@ defmodule DecentralisedBookIndexWeb.CoreComponents do
|
|||||||
name={@name}
|
name={@name}
|
||||||
value="true"
|
value="true"
|
||||||
checked={@checked}
|
checked={@checked}
|
||||||
class="rounded border-zinc-300 text-zinc-900 focus:ring-0"
|
class="rounded border-zinc-300 text-zinc-900 focus:ring-0 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
|
||||||
{@rest}
|
{@rest}
|
||||||
/>
|
/>
|
||||||
{@label}
|
{@label}
|
||||||
@@ -440,7 +440,7 @@ defmodule DecentralisedBookIndexWeb.CoreComponents do
|
|||||||
id={@id}
|
id={@id}
|
||||||
value={Phoenix.HTML.Form.normalize_value(@type, @value)}
|
value={Phoenix.HTML.Form.normalize_value(@type, @value)}
|
||||||
class={[
|
class={[
|
||||||
"mt-2 block w-full rounded-lg text-zinc-900 focus:ring-0 sm:text-sm sm:leading-6",
|
"mt-2 block w-full rounded-lg text-zinc-900 focus:ring-0 sm:text-sm sm:leading-6 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",
|
||||||
@errors == [] && "border-zinc-300 focus:border-zinc-400",
|
@errors == [] && "border-zinc-300 focus:border-zinc-400",
|
||||||
@errors != [] && "border-rose-400 focus:border-rose-400"
|
@errors != [] && "border-rose-400 focus:border-rose-400"
|
||||||
]}
|
]}
|
||||||
@@ -459,7 +459,7 @@ defmodule DecentralisedBookIndexWeb.CoreComponents do
|
|||||||
|
|
||||||
def label(assigns) do
|
def label(assigns) do
|
||||||
~H"""
|
~H"""
|
||||||
<label for={@for} class="block text-sm font-semibold leading-6 text-zinc-800">
|
<label for={@for} class="block text-sm font-semibold leading-6 text-zinc-800 dark:text-white">
|
||||||
{render_slot(@inner_block)}
|
{render_slot(@inner_block)}
|
||||||
</label>
|
</label>
|
||||||
"""
|
"""
|
||||||
@@ -492,7 +492,7 @@ defmodule DecentralisedBookIndexWeb.CoreComponents do
|
|||||||
~H"""
|
~H"""
|
||||||
<header class={[@actions != [] && "flex items-center justify-between gap-6", @class]}>
|
<header class={[@actions != [] && "flex items-center justify-between gap-6", @class]}>
|
||||||
<div>
|
<div>
|
||||||
<h1 class="text-lg font-semibold leading-8 text-zinc-800">
|
<h1 class="text-lg font-semibold leading-8 text-zinc-800 dark:text-white">
|
||||||
{render_slot(@inner_block)}
|
{render_slot(@inner_block)}
|
||||||
</h1>
|
</h1>
|
||||||
<p :if={@subtitle != []} class="mt-2 text-sm leading-6 text-zinc-600">
|
<p :if={@subtitle != []} class="mt-2 text-sm leading-6 text-zinc-600">
|
||||||
|
|||||||
Reference in New Issue
Block a user