book review form
This commit is contained in:
parent
5731765e8d
commit
9f9f543773
2 changed files with 56 additions and 27 deletions
|
@ -673,4 +673,39 @@ defmodule WildWeb.CoreComponents do
|
|||
def translate_errors(errors, field) when is_list(errors) do
|
||||
for {^field, {msg, opts}} <- errors, do: translate_error({msg, opts})
|
||||
end
|
||||
|
||||
defp a_rating_star(assigns) do
|
||||
~H"""
|
||||
<input
|
||||
type="radio"
|
||||
class="peer -ms-5 size-5 bg-transparent border-0 text-transparent cursor-pointer appearance-none checked:bg-none focus:bg-none focus:ring-0 focus:ring-offset-0"
|
||||
name="hs-ratings-readonly"
|
||||
value={Phoenix.HTML.Form.normalize_value("radio", @value)}
|
||||
/>
|
||||
<label
|
||||
for="hs-ratings-readonly-1"
|
||||
class="peer-checked:text-yellow-400 text-gray-300 pointer-events-none dark:peer-checked:text-yellow-600 dark:text-neutral-600"
|
||||
>
|
||||
<svg
|
||||
class="shrink-0 size-6"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
fill="currentColor"
|
||||
viewBox="0 0 16 16"
|
||||
>
|
||||
<path d="M3.612 15.443c-.386.198-.824-.149-.746-.592l.83-4.73L.173 6.765c-.329-.314-.158-.888.283-.95l4.898-.696L7.538.792c.197-.39.73-.39.927 0l2.184 4.327 4.898.696c.441.062.612.636.282.95l-3.522 3.356.83 4.73c.078.443-.36.79-.746.592L8 13.187l-4.389 2.256z">
|
||||
</path>
|
||||
</svg>
|
||||
</label>
|
||||
"""
|
||||
end
|
||||
|
||||
def rating_stars(assigns) do
|
||||
~H"""
|
||||
<div class="flex flex-row-reverse justify-center gap-1">
|
||||
<.a_rating_star :for={i <- 1..10} value={i} />
|
||||
</div>
|
||||
"""
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue