Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! fixup! Add Menu component
Browse files Browse the repository at this point in the history
  • Loading branch information
davidalejandroaguilar committed Sep 1, 2024
1 parent c5fb425 commit 14234b9
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 1 deletion.
31 changes: 31 additions & 0 deletions app/views/components/examples/menus/horizontal_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module Examples
module Menus
class HorizontalComponent < Base
def title
"Horizontal menu"
end

def example
Menu :horizontal, :base_200 do |menu|
menu.item do
a do
"Item 1"
end
end

menu.item do
a do
"Item 2"
end
end

menu.item do
a do
"Item 3"
end
end
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
module Examples
module Menus
class HorizontalSubmenuComponent < Base
def title
"Horizontal submenu"
end

def example
Menu :horizontal, :base_200 do |menu|
menu.item do
a do
"Item 1"
end
end

menu.item do |item|
item.title do
"Parent"
end

item.submenu do |submenu|
submenu.item do
a do
"Submenu 1"
end
end

submenu.item do
a do
"Submenu 2"
end
end
end
end

menu.item do
a do
"Item 3"
end
end
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
module Examples
module Menus
class MegaMenuWithSubmenuResponsiveComponent < Base
def title
"Mega menu with submenu (responsive)"
end

def example
Menu :horizontal, :base_200, xl: :horizontal, class: "rounded-box lg:min-w-max" do |menu|
menu.item do
a do
"Item 1"
end
end

menu.item do |item|
item.title do
"Parent"
end

item.submenu do |submenu|
submenu.item do
a do
"Submenu 1"
end
end

submenu.item do
a do
"Submenu 2"
end
end
end
end

menu.item do
a do
"Item 3"
end
end
end
end
end
end
end
5 changes: 4 additions & 1 deletion app/views/examples/menus/show_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ def view_template
CombinedComponent,
CollapsibleSubMenuComponent,
FileTreeComponent,
WithActiveItemComponent
WithActiveItemComponent,
HorizontalComponent,
HorizontalSubmenuComponent,
MegaMenuWithSubmenuResponsiveComponent
]
end
end
Expand Down

0 comments on commit 14234b9

Please sign in to comment.