-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Parts.Sidebar create bottom navigation for small screens (#744)
- Loading branch information
1 parent
a9f64ae
commit 0d28428
Showing
5 changed files
with
122 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
defmodule Moon.Parts.Sidebar.BottomNavigation do | ||
@moduledoc false | ||
|
||
use Moon.StatelessComponent | ||
|
||
alias Moon.Icon | ||
alias Moon.Design.Chip | ||
|
||
@doc "Id attribute for DOM element" | ||
prop(id, :string) | ||
@doc "Data-testid attribute for DOM element" | ||
prop(testid, :string) | ||
@doc "Additional Tailwind classes" | ||
prop(class, :css_class) | ||
@doc "Additional Tailwind classes" | ||
prop(button_class, :css_class) | ||
@doc "Additional Tailwind classes" | ||
prop(logo_class, :css_class) | ||
@doc "Additional Tailwind classes" | ||
prop(icon_class, :css_class) | ||
@doc "Source of the svg" | ||
prop(src, :string, required: true) | ||
@doc "Icon name" | ||
prop(icon, :string) | ||
@doc "Href attribute for Logo" | ||
prop(href, :string) | ||
@doc "On click event to open sidebar" | ||
prop(on_click, :event) | ||
|
||
def render(assigns) do | ||
~F""" | ||
<div | ||
{=@id} | ||
data-testid={@testid} | ||
class={merge([ | ||
"fixed bottom-12 z-[9999] justify-center lg:hidden items-center left-1/2 transform -translate-x-1/2 bg-bulma rounded-full flex flex-row p-1 gap-0 h-14 w-[6.5rem]", | ||
@class | ||
])} | ||
> | ||
<a href={@href}> | ||
<Chip class={merge([ | ||
"bg-transparent h-12 w-12 px-2 py-2 justify-center items-center rounded-moon-i-xx rounded-full", | ||
@button_class | ||
])}> | ||
<svg class={merge([ | ||
"moon-logo h-8 w-8 text-goku hover:text-goku active:text-goku focus:text-goku", | ||
@logo_class | ||
])}> | ||
<use href={@src} /> | ||
</svg> | ||
</Chip> | ||
</a> | ||
<Chip | ||
class={merge([ | ||
"bg-transparent h-12 w-12 px-2 py-2 justify-center items-center rounded-moon-i-xx rounded-full", | ||
@button_class | ||
])} | ||
{=@on_click} | ||
> | ||
<Icon name={@icon || "generic_menu"} class={merge(["text-moon-24 text-goku", @icon_class])} /> | ||
</Chip> | ||
</div> | ||
""" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters