@@ -17,36 +17,107 @@ def view_template
17
17
Views ::Docs ::Sidebar ::InsetExample ::CODE
18
18
end
19
19
20
- render div do
21
- div do
22
- Components . Heading ( level : 4 ) { "Dialog variant" }
23
-
24
- Tabs ( default_value : "preview" ) do
25
- TabsList do
26
- TabsTrigger ( value : "preview" ) do
27
- span { "Preview" }
28
- end
29
- TabsTrigger ( value : "code" ) do
30
- span { "Code" }
31
- end
32
- end
33
-
34
- TabsContent ( value : "preview" ) do
35
- Link ( href : "/docs/sidebar/dialog" , target : :_blank , variant : :primary ) { "Open in another tab" }
20
+ render Docs ::VisualCodeExample . new ( title : "Dialog variant" , context : self ) do
21
+ <<~RUBY
22
+ Dialog(data: {action: "ruby-ui--dialog:connect->ruby-ui--dialog#open"}) do
23
+ DialogTrigger do
24
+ Button { "Open Dialog" }
36
25
end
37
-
38
- TabsContent ( value : "code" ) do
39
- div ( class : "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 relative rounded-md border" ) do
40
- Codeblock ( Views ::Docs ::Sidebar ::DialogExample ::CODE , syntax : :ruby , class : "-m-px" )
26
+ DialogContent(class: "grid overflow-hidden p-0 md:max-h-[500px] md:max-w-[700px] lg:max-w-[800px]") do
27
+ SidebarWrapper(class: "items-start") do
28
+ Sidebar(collapsible: :none, class: "hidden md:flex") do
29
+ SidebarContent do
30
+ SidebarGroup do
31
+ SidebarGroupContent do
32
+ SidebarMenu do
33
+ SidebarMenuItem do
34
+ SidebarMenuButton(as: :a, href: "#") do
35
+ search_icon()
36
+ span { "Search" }
37
+ end
38
+ end
39
+ SidebarMenuItem do
40
+ SidebarMenuButton(as: :a, href: "#", active: true) do
41
+ home_icon()
42
+ span { "Home" }
43
+ end
44
+ end
45
+ SidebarMenuItem do
46
+ SidebarMenuButton(as: :a, href: "#") do
47
+ inbox_icon()
48
+ span { "Inbox" }
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ main(class: "flex h-[480px] flex-1 flex-col overflow-hidden") do
57
+ end
41
58
end
42
59
end
43
60
end
44
- end
61
+ RUBY
45
62
end
46
63
47
64
render Components ::ComponentSetup ::Tabs . new ( component_name : component )
48
65
49
66
render Docs ::ComponentsTable . new ( component_files ( component ) )
50
67
end
51
68
end
69
+
70
+ def search_icon
71
+ svg (
72
+ xmlns : "http://www.w3.org/2000/svg" ,
73
+ width : "24" ,
74
+ height : "24" ,
75
+ viewBox : "0 0 24 24" ,
76
+ fill : "none" ,
77
+ stroke : "currentColor" ,
78
+ stroke_width : "2" ,
79
+ stroke_linecap : "round" ,
80
+ stroke_linejoin : "round" ,
81
+ class : "lucide lucide-search"
82
+ ) do |s |
83
+ s . circle ( cx : "11" , cy : "11" , r : "8" )
84
+ s . path ( d : "M21 21L16.7 16.7" )
85
+ end
86
+ end
87
+
88
+ def home_icon
89
+ svg (
90
+ xmlns : "http://www.w3.org/2000/svg" ,
91
+ width : "24" ,
92
+ height : "24" ,
93
+ viewBox : "0 0 24 24" ,
94
+ fill : "none" ,
95
+ stroke : "currentColor" ,
96
+ stroke_width : "2" ,
97
+ stroke_linecap : "round" ,
98
+ stroke_linejoin : "round" ,
99
+ class : "lucide lucide-house"
100
+ ) do |s |
101
+ s . path ( d : "M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8" )
102
+ s . path ( d : "M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" )
103
+ end
104
+ end
105
+
106
+ def inbox_icon
107
+ svg (
108
+ xmlns : "http://www.w3.org/2000/svg" ,
109
+ width : "24" ,
110
+ height : "24" ,
111
+ viewBox : "0 0 24 24" ,
112
+ fill : "none" ,
113
+ stroke : "currentColor" ,
114
+ stroke_width : "2" ,
115
+ stroke_linecap : "round" ,
116
+ stroke_linejoin : "round" ,
117
+ class : "lucide lucide-inbox"
118
+ ) do |s |
119
+ s . polyline ( points : "22 12 16 12 14 15 10 15 8 12 2 12" )
120
+ s . path ( d : "M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z" )
121
+ end
122
+ end
52
123
end
0 commit comments