Skip to content

Commit 992b5e3

Browse files
committed
Add missing stub classes and methods for documentation
- Update VisualCodeExample to accept description and src parameters - Add InlineLink, Text, Alert, AlertTitle, AlertDescription helpers - Add route helper stubs (docs_*_path methods) - Add sidebar example constants
1 parent 035255d commit 992b5e3

File tree

3 files changed

+82
-1
lines changed

3 files changed

+82
-1
lines changed

lib/ruby_ui/docs/base.rb

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,61 @@ def Heading(level:, &)
1010
def component_files(component_name)
1111
[]
1212
end
13+
14+
# Text helper for wrapping paragraphs
15+
def Text(&)
16+
p(&)
17+
end
18+
19+
# InlineLink helper for documentation links
20+
def InlineLink(href:, target: nil, class: nil, &)
21+
a(href: href, target: target, class: binding.local_variable_get(:class), &)
22+
end
23+
24+
# Alert component helpers
25+
def Alert(&)
26+
div(&)
27+
end
28+
29+
def AlertTitle(&)
30+
h4(&)
31+
end
32+
33+
def AlertDescription(&)
34+
p(&)
35+
end
36+
37+
# Route helper stubs - return "#" as placeholder
38+
def docs_sheet_path
39+
"#"
40+
end
41+
42+
def docs_separator_path
43+
"#"
44+
end
45+
46+
def docs_accordion_path
47+
"#"
48+
end
49+
50+
def docs_alert_path
51+
"#"
52+
end
53+
54+
def docs_alert_dialog_path
55+
"#"
56+
end
57+
58+
def docs_aspect_ratio_path
59+
"#"
60+
end
61+
62+
def docs_avatar_path
63+
"#"
64+
end
65+
66+
def docs_badge_path
67+
"#"
68+
end
1369
end
1470
end
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# frozen_string_literal: true
2+
3+
# Stub constants for sidebar documentation examples
4+
# These are replaced with actual implementations in the web app
5+
6+
module Views
7+
module Docs
8+
class Sidebar < Views::Base
9+
class Example
10+
CODE = <<~RUBY
11+
# Sidebar example code placeholder
12+
RUBY
13+
end
14+
15+
class InsetExample
16+
CODE = <<~RUBY
17+
# Sidebar inset example code placeholder
18+
RUBY
19+
end
20+
end
21+
end
22+
end

lib/ruby_ui/docs/visual_code_example.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22

33
module Docs
44
class VisualCodeExample < Phlex::HTML
5-
def initialize(title:, context:)
5+
def initialize(title:, context:, description: nil, src: nil)
66
@title = title
77
@context = context
8+
@description = description
9+
@src = src
810
end
911

1012
def view_template(&block)
1113
code = block.call
1214
div do
1315
h3 { @title }
16+
p { @description } if @description
1417
pre { code }
1518
@context.instance_eval(code)
1619
end

0 commit comments

Comments
 (0)