@@ -29,8 +29,31 @@ def view_template
2929
3030 Heading ( level : 2 ) { "Examples" }
3131 Heading ( level : 3 ) { "Types" }
32- div ( class : "grid gap-4 sm:grid-cols-2" , data : { controller : "toast-demo" } ) do
33- EXAMPLES . each { |ex | example_box ( ex ) }
32+ render Docs ::VisualCodeExample . new ( title : "Click any to spawn a toast." , context : self ) do
33+ <<~RUBY
34+ div(class: "grid gap-4 sm:grid-cols-2", data: {controller: "toast-demo"}) do
35+ [
36+ ["default", "Default"],
37+ ["success", "Success"],
38+ ["info", "Info"],
39+ ["warning", "Warning"],
40+ ["error", "Error"],
41+ ["with_action", "With Action"],
42+ ["promise", "Promise"],
43+ ["text_only", "Text Only"],
44+ ["close_button", "Close Button"],
45+ ["close_action", "Close + Action"]
46+ ].each do |key, label|
47+ div(class: "rounded-md border p-6 flex items-center justify-center min-h-[100px]") do
48+ button(
49+ type: "button",
50+ class: "inline-flex items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium hover:bg-accent transition-colors cursor-pointer",
51+ data: {action: "click->toast-demo#fire", toast_demo_kind_param: key}
52+ ) { "Show \# {label} toast" }
53+ end
54+ end
55+ end
56+ RUBY
3457 end
3558
3659 Heading ( level : 2 ) { "About" }
0 commit comments