Skip to content

Commit

Permalink
fix: Fix leftmenu.
Browse files Browse the repository at this point in the history
  • Loading branch information
GSMLG-BOT committed Aug 8, 2024
1 parent b8fbb53 commit 0a9591f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,35 @@ defmodule DuskmoonStorybookWeb.Storybook.Components.LeftMenu do
]}
]
},
slots: ["<:title>Menu Demo Components</:title>"]
slots: [
"<:title>Menu Demo Components</:title>",
"<:menu><a>Dashboard</a></:menu>",
"""
<:menu>
<h2 class="menu-title">Title</h2>
<ul>
<li><a>Submenu 1</a></li>
<li><a>Submenu 2</a></li>
</ul>
</:menu>
<:menu>
<a>Parent</a>
<ul>
<li><a>Submenu 1</a></li>
<li><a>Submenu 2</a></li>
</ul>
</:menu>
<:menu>
<details open>
<summary>Parent</summary>
<ul>
<li><a>Submenu 1</a></li>
<li><a>Submenu 2</a></li>
</ul>
</details>
</:menu>
"""
]
}
]
end
Expand Down
25 changes: 11 additions & 14 deletions apps/phoenix_duskmoon/lib/phoenix_duskmoon/component/left_menu.ex
Original file line number Diff line number Diff line change
Expand Up @@ -62,31 +62,28 @@ defmodule PhoenixDuskmoon.Component.LeftMenu do
id={@id}
class={[
"flex flex-col justify-start items-start",
"h-full pt-4",
@class,
]}
>
<%= if length(@title) > 0 do %>
<div
:for={{title, _i} <- Enum.with_index(@title)}
class={[
"flex flex-row justify-start items-center",
"px-10 py-4 w-full",
"flex px-4 py-2",
Map.get(title, :class, ""),
]}
>
<%= render_slot(title) %>
</div>
<% end %>
<div
:for={{m, _i} <- Enum.with_index(@menu)}
class={[
"flex flex-col justify-start items-start w-full",
Map.get(m, :class, "")
]}
>
<%= render_slot(m) %>
</div>
<ul class="menu w-full">
<li
:for={{m, _i} <- Enum.with_index(@menu)}
class={[
Map.get(m, :class)
]}
>
<%= render_slot(m) %>
</li>
</ul>
</nav>
"""
end
Expand Down

0 comments on commit 0a9591f

Please sign in to comment.