Skip to content

Commit

Permalink
input & migrating from phx-feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ChivukulaVirinchi committed Oct 18, 2024
1 parent 1c62f60 commit 5232c39
Show file tree
Hide file tree
Showing 12 changed files with 1,071 additions and 1,171 deletions.
6 changes: 0 additions & 6 deletions assets/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ module.exports = {
//
// <div class="phx-click-loading:animate-ping">
//
plugin(({ addVariant }) =>
addVariant("phx-no-feedback", [
".phx-no-feedback&",
".phx-no-feedback &",
]),
),
plugin(({ addVariant }) =>
addVariant("phx-click-loading", [
".phx-click-loading&",
Expand Down
2 changes: 1 addition & 1 deletion lib/library_web/components/core_components.ex
Original file line number Diff line number Diff line change
Expand Up @@ -368,13 +368,13 @@ defmodule LibraryWeb.CoreComponents do
name={@name}
id={@id}
value={Phoenix.HTML.Form.normalize_value(@type, @value)}
{@rest}
class={[
"mt-2 block w-full rounded-lg text-zinc-900 focus:ring-0 sm:text-sm sm:leading-6",
"phx-no-feedback:border-zinc-300 phx-no-feedback:focus:border-zinc-400",
@errors == [] && "border-zinc-300 focus:border-zinc-400",
@errors != [] && "border-rose-400 focus:border-rose-400"
]}
{@rest}
/>
<.error :for={msg <- @errors}><%= msg %></.error>
</div>
Expand Down
2 changes: 1 addition & 1 deletion lib/library_web/components/dropdown.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Dropdown do
use Phoenix.Component
slot :content, required: true
slot :trigger, requirded: true
slot :trigger, required: true
attr :class, :string, default: ""

attr :rest, :global,
Expand Down
14 changes: 14 additions & 0 deletions lib/library_web/components/error.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
defmodule Error do
use Phoenix.Component
slot :inner_block, required: true

def error(assigns) do
~H"""
<p class="flex gap-3 mt-3 text-sm leading-6 text-rose-600 phx-no-feedback:hidden">
<LibraryWeb.CoreComponents.icon name="hero-exclamation-circle-mini" class="mt-0.5 h-5 w-5 flex-none" />
<%= render_slot(@inner_block) %>
</p>
"""
end

end
Loading

0 comments on commit 5232c39

Please sign in to comment.