Skip to content

Commit

Permalink
fixed form for warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
cblavier committed Feb 14, 2023
1 parent 0c72d10 commit f5c9dea
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion guides/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ In template, you can pass some extra attributes to your variation. Just add them

```elixir
"""
<.form_for for={:user} :let={f}>
<.form_for :let={f} for={%{}} as={:user}>
<.lsb-variation form={f}/>
</.form>
"""
Expand Down
9 changes: 8 additions & 1 deletion lib/phx_live_storybook/live/search.ex
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,14 @@ defmodule PhxLiveStorybook.Search do
phx-click-away={JS.dispatch("lsb:close-search")}
class="lsb lsb-opacity-0 lsb-scale-90 lsb-mx-auto lsb-max-w-xl lsb-mt-16 lsb-transform lsb-divide-y lsb-divide-gray-100 lsb-overflow-hidden lsb-rounded-xl lsb-bg-white lsb-shadow-2xl lsb-transition-all"
>
<.form :let={f} for={:search} phx-debounce={500} id="search-form" class="lsb lsb-relative">
<.form
:let={f}
for={%{}}
as={:search}
phx-debounce={500}
id="search-form"
class="lsb lsb-relative"
>
<.fa_icon
style={:light}
name="search"
Expand Down
6 changes: 4 additions & 2 deletions lib/phx_live_storybook/live/story/playground.ex
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,8 @@ defmodule PhxLiveStorybook.Story.Playground do
~H"""
<.form
:let={f}
for={:playground}
for={%{}}
as={:playground}
id={form_id(@story)}
phx-change="playground-change"
phx-target={@myself}
Expand Down Expand Up @@ -462,7 +463,8 @@ defmodule PhxLiveStorybook.Story.Playground do
<%= unless Enum.empty?(@story.merged_attributes()) do %>
<.form
:let={f}
for={:variation}
for={%{}}
as={:variation}
id="variation-selection-form"
class="lsb lsb-flex lsb-flex-col md:lsb-flex-row lsb-space-y-1 md:lsb-space-x-2 lsb-justify-end lsb-w-full lsb-mb-6"
>
Expand Down
3 changes: 2 additions & 1 deletion lib/phx_live_storybook/live/story_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ defmodule PhxLiveStorybook.StoryLive do
<!-- mobile version of navigation tabs -->
<.form
:let={f}
for={:navigation}
for={%{}}
as={:navigation}
id={"#{Macro.underscore(@story)}-navigation-form"}
class="lsb story-nav-form lg:lsb-hidden"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule Storybook.CoreComponents.Input do

def template do
"""
<.simple_form for={:story} :let={f} class="w-full">
<.simple_form :let={f} for={%{}} as={:story} class="w-full">
<.lsb-variation-group field={{f, :field}}/>
</.simple_form>
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ defmodule Storybook.Examples.CoreComponents do
<:subtitle>This won't be persisted into DB, memory only</:subtitle>
<.simple_form
:let={f}
for={:user}
for={%{}}
as={:user}
phx-submit={JS.push("save_user") |> hide_modal("new-user-modal")}
>
<.input field={{f, :first_name}} label="First name" />
Expand Down

0 comments on commit f5c9dea

Please sign in to comment.