Skip to content

Commit

Permalink
Additional curly braces
Browse files Browse the repository at this point in the history
  • Loading branch information
bcardarella committed Dec 12, 2024
1 parent 0451c9f commit e5b5034
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
21 changes: 12 additions & 9 deletions lib/live_view_native/swiftui/component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,13 @@ defmodule LiveViewNative.SwiftUI.Component do
"""
)

# `NavigationLink` always pushes a new page.
# attr(:replace, :boolean,
# default: false,
# doc: """
# When using `:patch` or `:navigate`,
# should the browser's history be replaced with `pushState`?
# """
# )
attr(:replace, :boolean,
default: false,
doc: """
When using `:patch` or `:navigate`,
should the browser's history be replaced with `pushState`?
"""
)

# attr(:method, :string,
# default: "get",
Expand Down Expand Up @@ -195,7 +194,11 @@ defmodule LiveViewNative.SwiftUI.Component do

def link(%{navigate: to} = assigns) when is_binary(to) do
~LVN"""
<NavigationLink destination={@navigate} {@rest}>
<NavigationLink
destination={@navigate}
data-phx-link-state={if @replace, do: "replace", else: "push"}
{@rest}
>
<%= render_slot(@inner_block) %>
</NavigationLink>
"""
Expand Down
2 changes: 1 addition & 1 deletion priv/templates/lvn.gen.layout/app.neex
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<.flash_group flash={@flash} />
<%%= @inner_content %>
{@inner_content}
4 changes: 2 additions & 2 deletions priv/templates/lvn.gen.layout/root.neex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<.csrf_token />
<Style url={~p"/assets/app.<%= context.format %>.styles"} />
<NavigationStack>
<%%= @inner_content %>
</NavigationStack>
{@inner_content}
</NavigationStack>

0 comments on commit e5b5034

Please sign in to comment.