Skip to content

Commit e2678f2

Browse files
authored
Add the sidebar component (#180)
1 parent 27e8fb7 commit e2678f2

File tree

5 files changed

+44
-2
lines changed

5 files changed

+44
-2
lines changed

Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ GIT
1414

1515
GIT
1616
remote: https://github.com/ruby-ui/ruby_ui.git
17-
revision: 957bcffb1e393b7db30c7576734f4ad5b40bb7cf
17+
revision: eea116e5fa397a1b544fb8574a8014e132193e90
1818
branch: main
1919
specs:
20-
ruby_ui (1.0.0.beta1)
20+
ruby_ui (1.0.0.rc1)
2121

2222
GEM
2323
remote: https://rubygems.org/

app/components/shared/menu.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def components
9696
{name: "Progress", path: docs_progress_path, badge: "New"},
9797
{name: "Radio Button", path: docs_radio_button_path, badge: "New"},
9898
{name: "Select", path: docs_select_path, badge: "New"},
99+
{name: "Separator", path: docs_separator_path, badge: "New"},
99100
{name: "Sheet", path: docs_sheet_path},
100101
{name: "Shortcut Key", path: docs_shortcut_key_path},
101102
{name: "Skeleton", path: docs_skeleton_path, badge: "New"},

app/controllers/docs_controller.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ def select
166166
render Views::Docs::Select.new
167167
end
168168

169+
def separator
170+
render Views::Docs::Separator.new
171+
end
172+
169173
def sheet
170174
render Views::Docs::Sheet.new
171175
end

app/views/docs/separator.rb

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# frozen_string_literal: true
2+
3+
class Views::Docs::Separator < Views::Base
4+
def view_template
5+
component = "Separator"
6+
7+
div(class: "max-w-2xl mx-auto w-full py-10 space-y-10") do
8+
render Docs::Header.new(title: "Separator", description: "Visually or semantically separates content.")
9+
10+
Heading(level: 2) { "Usage" }
11+
12+
render Docs::VisualCodeExample.new(title: "Example", context: self) do
13+
<<~RUBY
14+
div do
15+
div(class: "space-y-1") do
16+
h4(class: "text-sm font-medium leading-none") { "RubyUI" }
17+
p(class: "text-sm text-muted-foreground") { "An open-source UI component library." }
18+
end
19+
Separator(class: "my-4")
20+
div(class: "flex h-5 items-center space-x-4 text-sm") do
21+
div { "Blog" }
22+
Separator(as: :hr, orientation: :vertical)
23+
div { "Docs" }
24+
Separator(orientation: :vertical)
25+
div { "Source" }
26+
end
27+
end
28+
RUBY
29+
end
30+
31+
render Components::ComponentSetup::Tabs.new(component_name: component)
32+
33+
render Docs::ComponentsTable.new(component_files(component))
34+
end
35+
end
36+
end

config/routes.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
get "progress", to: "docs#progress", as: :docs_progress
4848
get "radio_button", to: "docs#radio_button", as: :docs_radio_button
4949
get "select", to: "docs#select", as: :docs_select
50+
get "separator", to: "docs#separator", as: :docs_separator
5051
get "sheet", to: "docs#sheet", as: :docs_sheet
5152
get "shortcut_key", to: "docs#shortcut_key", as: :docs_shortcut_key
5253
get "skeleton", to: "docs#skeleton", as: :docs_skeleton

0 commit comments

Comments
 (0)