Class: Views::Docs::DropdownMenu
- Defined in:
- lib/ruby_ui/dropdown_menu/dropdown_menu_docs.rb
Instance Method Summary collapse
Methods inherited from Base
#Alert, #AlertDescription, #AlertTitle, #Heading, #InlineCode, #InlineLink, #Text, #component_files, #docs_accordion_path, #docs_alert_dialog_path, #docs_alert_path, #docs_aspect_ratio_path, #docs_avatar_path, #docs_badge_path, #docs_installation_path, #docs_separator_path, #docs_sheet_path
Instance Method Details
#view_template ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/ruby_ui/dropdown_menu/dropdown_menu_docs.rb', line 4 def view_template component = "DropdownMenu" div(class: "max-w-2xl mx-auto w-full py-10 space-y-10") do render Docs::Header.new(title: "Dropdown Menu", description: "Displays a menu to the user — such as a set of actions or functions — triggered by a button.") Heading(level: 2) { "Usage" } render Docs::VisualCodeExample.new(title: "Example", context: self) do " DropdownMenu do\n DropdownMenuTrigger(class: 'w-full') do\n Button(variant: :outline) { \"Open\" }\n end\n DropdownMenuContent do\n DropdownMenuLabel { \"My Account\" }\n DropdownMenuSeparator\n DropdownMenuItem(href: '#') { \"Profile\" }\n DropdownMenuItem(href: '#') { \"Billing\" }\n DropdownMenuItem(href: '#') { \"Team\" }\n DropdownMenuItem(href: '#') { \"Subscription\" }\n end\n end\n RUBY\n end\n\n render Docs::VisualCodeExample.new(title: \"Placement\", description: \"If the DropdownMenu conflicts with edge, it will auto-adjust it's placement\", context: self) do\n <<~RUBY\n div(class: 'grid grid-cols-1 sm:grid-cols-3 gap-4') do\n # -- TOP --\n DropdownMenu(options: { placement: 'top' }) do\n DropdownMenuTrigger(class: 'w-full') do\n Button(variant: :outline, class: 'w-full justify-center') { 'top' }\n end\n DropdownMenuContent do\n DropdownMenuLabel { \"My Account\" }\n DropdownMenuSeparator\n DropdownMenuItem(href: '#') { \"Profile\" }\n DropdownMenuItem(href: '#') { \"Billing\" }\n DropdownMenuItem(href: '#') { \"Team\" }\n DropdownMenuItem(href: '#') { \"Subscription\" }\n end\n end\n\n DropdownMenu(options: { placement: 'top-start' }) do\n DropdownMenuTrigger(class: 'w-full') do\n Button(variant: :outline, class: 'w-full justify-center') { 'top-start' }\n end\n DropdownMenuContent do\n DropdownMenuLabel { \"My Account\" }\n DropdownMenuSeparator\n DropdownMenuItem(href: '#') { \"Profile\" }\n DropdownMenuItem(href: '#') { \"Billing\" }\n DropdownMenuItem(href: '#') { \"Team\" }\n DropdownMenuItem(href: '#') { \"Subscription\" }\n end\n end\n\n DropdownMenu(options: { placement: 'top-end' }) do\n DropdownMenuTrigger(class: 'w-full') do\n Button(variant: :outline, class: 'w-full justify-center') { 'top-end' }\n end\n DropdownMenuContent do\n DropdownMenuLabel { \"My Account\" }\n DropdownMenuSeparator\n DropdownMenuItem(href: '#') { \"Profile\" }\n DropdownMenuItem(href: '#') { \"Billing\" }\n DropdownMenuItem(href: '#') { \"Team\" }\n DropdownMenuItem(href: '#') { \"Subscription\" }\n end\n end\n\n # -- BOTTOM --\n DropdownMenu(options: { placement: 'bottom' }) do\n DropdownMenuTrigger(class: 'w-full') do\n Button(variant: :outline, class: 'w-full justify-center') { 'bottom' }\n end\n DropdownMenuContent do\n DropdownMenuLabel { \"My Account\" }\n DropdownMenuSeparator\n DropdownMenuItem(href: '#') { \"Profile\" }\n DropdownMenuItem(href: '#') { \"Billing\" }\n DropdownMenuItem(href: '#') { \"Team\" }\n DropdownMenuItem(href: '#') { \"Subscription\" }\n end\n end\n\n DropdownMenu(options: { placement: 'bottom-start' }) do\n DropdownMenuTrigger(class: 'w-full') do\n Button(variant: :outline, class: 'w-full justify-center') { 'bottom-start' }\n end\n DropdownMenuContent do\n DropdownMenuLabel { \"My Account\" }\n DropdownMenuSeparator\n DropdownMenuItem(href: '#') { \"Profile\" }\n DropdownMenuItem(href: '#') { \"Billing\" }\n DropdownMenuItem(href: '#') { \"Team\" }\n DropdownMenuItem(href: '#') { \"Subscription\" }\n end\n end\n\n DropdownMenu(options: { placement: 'bottom-end' }) do\n DropdownMenuTrigger(class: 'w-full') do\n Button(variant: :outline, class: 'w-full justify-center') { 'bottom-end' }\n end\n DropdownMenuContent do\n DropdownMenuLabel { \"My Account\" }\n DropdownMenuSeparator\n DropdownMenuItem(href: '#') { \"Profile\" }\n DropdownMenuItem(href: '#') { \"Billing\" }\n DropdownMenuItem(href: '#') { \"Team\" }\n DropdownMenuItem(href: '#') { \"Subscription\" }\n end\n end\n\n # -- LEFT --\n DropdownMenu(options: { placement: 'left' }) do\n DropdownMenuTrigger(class: 'w-full') do\n Button(variant: :outline, class: 'w-full justify-center') { 'left' }\n end\n DropdownMenuContent do\n DropdownMenuLabel { \"My Account\" }\n DropdownMenuSeparator\n DropdownMenuItem(href: '#') { \"Profile\" }\n DropdownMenuItem(href: '#') { \"Billing\" }\n DropdownMenuItem(href: '#') { \"Team\" }\n DropdownMenuItem(href: '#') { \"Subscription\" }\n end\n end\n\n DropdownMenu(options: { placement: 'left-start' }) do\n DropdownMenuTrigger(class: 'w-full') do\n Button(variant: :outline, class: 'w-full justify-center') { 'left-start' }\n end\n DropdownMenuContent do\n DropdownMenuLabel { \"My Account\" }\n DropdownMenuSeparator\n DropdownMenuItem(href: '#') { \"Profile\" }\n DropdownMenuItem(href: '#') { \"Billing\" }\n DropdownMenuItem(href: '#') { \"Team\" }\n DropdownMenuItem(href: '#') { \"Subscription\" }\n end\n end\n\n DropdownMenu(options: { placement: 'left-end' }) do\n DropdownMenuTrigger(class: 'w-full') do\n Button(variant: :outline, class: 'w-full justify-center') { 'left-end' }\n end\n DropdownMenuContent do\n DropdownMenuLabel { \"My Account\" }\n DropdownMenuSeparator\n DropdownMenuItem(href: '#') { \"Profile\" }\n DropdownMenuItem(href: '#') { \"Billing\" }\n DropdownMenuItem(href: '#') { \"Team\" }\n DropdownMenuItem(href: '#') { \"Subscription\" }\n end\n end\n\n # -- RIGHT --\n DropdownMenu(options: { placement: 'right' }) do\n DropdownMenuTrigger(class: 'w-full') do\n Button(variant: :outline, class: 'w-full justify-center') { 'right' }\n end\n DropdownMenuContent do\n DropdownMenuLabel { \"My Account\" }\n DropdownMenuSeparator\n DropdownMenuItem(href: '#') { \"Profile\" }\n DropdownMenuItem(href: '#') { \"Billing\" }\n DropdownMenuItem(href: '#') { \"Team\" }\n DropdownMenuItem(href: '#') { \"Subscription\" }\n end\n end\n\n DropdownMenu(options: { placement: 'right-start' }) do\n DropdownMenuTrigger(class: 'w-full') do\n Button(variant: :outline, class: 'w-full justify-center') { 'right-start' }\n end\n DropdownMenuContent do\n DropdownMenuLabel { \"My Account\" }\n DropdownMenuSeparator\n DropdownMenuItem(href: '#') { \"Profile\" }\n DropdownMenuItem(href: '#') { \"Billing\" }\n DropdownMenuItem(href: '#') { \"Team\" }\n DropdownMenuItem(href: '#') { \"Subscription\" }\n end\n end\n\n DropdownMenu(options: { placement: 'right-end' }) do\n DropdownMenuTrigger(class: 'w-full') do\n Button(variant: :outline, class: 'w-full justify-center') { 'right-end' }\n end\n DropdownMenuContent do\n DropdownMenuLabel { \"My Account\" }\n DropdownMenuSeparator\n DropdownMenuItem(href: '#') { \"Profile\" }\n DropdownMenuItem(href: '#') { \"Billing\" }\n DropdownMenuItem(href: '#') { \"Team\" }\n DropdownMenuItem(href: '#') { \"Subscription\" }\n end\n end\n end\n RUBY\n end\n\n render Components::ComponentSetup::Tabs.new(component_name: component)\n\n render Docs::ComponentsTable.new(component_files(component))\n end\nend\n" |