Skip to content

Commit 2c9c590

Browse files
authored
Split live from root template (#152)
1 parent 4fa34ed commit 2c9c590

3 files changed

Lines changed: 17 additions & 14 deletions

File tree

lib/elixir_console_web.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ defmodule ElixirConsoleWeb do
4343

4444
def live_view do
4545
quote do
46-
use Phoenix.LiveView
46+
use Phoenix.LiveView, layout: {ElixirConsoleWeb.LayoutView, "live.html"}
4747

4848
unquote(view_helpers())
4949
end
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<main role="main" class="w-full h-full">
2+
<p class="alert alert-info" role="alert"
3+
phx-click="lv:clear-flash"
4+
phx-value-key="info"><%= live_flash(@flash, :info) %></p>
5+
6+
<p class="alert alert-danger" role="alert"
7+
phx-click="lv:clear-flash"
8+
phx-value-key="error"><%= live_flash(@flash, :error) %></p>
9+
10+
<div class="bg-teal-900 w-full h-full rounded overflow-hidden shadow-lg live-view-parent">
11+
<%= @inner_content %>
12+
</div>
13+
</main>

lib/elixir_console_web/templates/layout/root.html.heex

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,8 @@
3939
</svg>
4040
</a>
4141
</header>
42-
<main role="main" class="w-full h-full flex-1 overflow-hidden">
43-
<p class="alert alert-info" role="alert"
44-
phx-click="lv:clear-flash"
45-
phx-value-key="info"><%= live_flash(@flash, :info) %></p>
46-
47-
<p class="alert alert-danger" role="alert"
48-
phx-click="lv:clear-flash"
49-
phx-value-key="error"><%= live_flash(@flash, :error) %></p>
50-
51-
<div class="bg-teal-900 w-full h-full rounded overflow-hidden shadow-lg live-view-parent">
52-
<%= @inner_content %>
53-
</div>
54-
</main>
42+
<div class="live-view-parent h-full overflow-hidden">
43+
<%= @inner_content %>
44+
</div>
5545
</body>
5646
</html>

0 commit comments

Comments
 (0)