m9sh 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.idea/hotcdn.iml +30 -0
- data/.mise.toml +2 -2
- data/app/assets/config/manifest.js +4 -0
- data/app/assets/images/icons/activity.svg +3 -0
- data/app/assets/images/icons/bell.svg +4 -0
- data/app/assets/images/icons/book.svg +4 -0
- data/app/assets/images/icons/chevron-down.svg +3 -0
- data/app/assets/images/icons/chevron-left.svg +3 -0
- data/app/assets/images/icons/chevron-right.svg +3 -0
- data/app/assets/images/icons/credit-card.svg +4 -0
- data/app/assets/images/icons/dollar-sign.svg +3 -0
- data/app/assets/images/icons/edit.svg +4 -0
- data/app/assets/images/icons/github.svg +3 -0
- data/app/assets/images/icons/home.svg +4 -0
- data/app/assets/images/icons/info.svg +5 -0
- data/app/assets/images/icons/layout.svg +6 -0
- data/app/assets/images/icons/logout.svg +5 -0
- data/app/assets/images/icons/menu.svg +5 -0
- data/app/assets/images/icons/moon.svg +3 -0
- data/app/assets/images/icons/paintbrush.svg +6 -0
- data/app/assets/images/icons/search.svg +4 -0
- data/app/assets/images/icons/settings.svg +4 -0
- data/app/assets/images/icons/sun.svg +11 -0
- data/app/assets/images/icons/user.svg +4 -0
- data/app/assets/images/icons/users.svg +5 -0
- data/app/assets/stylesheets/tailwind.css +1180 -0
- data/app/components/backdrop_component.rb +103 -0
- data/app/components/docs/code_block_component.rb +56 -0
- data/app/components/docs/component_api_component.rb +16 -0
- data/app/components/docs/component_examples_component.rb +16 -0
- data/app/components/docs/component_header_component.html.erb +8 -0
- data/app/components/docs/component_header_component.rb +14 -0
- data/app/components/docs/component_installation_component.html.erb +15 -0
- data/app/components/docs/component_installation_component.rb +13 -0
- data/app/components/docs/component_page_component.html.erb +9 -0
- data/app/components/docs/component_page_component.rb +19 -0
- data/app/components/docs/component_preview_component.rb +318 -0
- data/app/components/docs/component_usage_component.rb +18 -0
- data/app/components/docs/prop_table_component.rb +64 -0
- data/app/controllers/application_controller.rb +3 -0
- data/app/controllers/blocks_controller.rb +51 -0
- data/app/controllers/docs_controller.rb +162 -0
- data/app/controllers/showcase_controller.rb +42 -0
- data/app/helpers/blocks_helper.rb +343 -0
- data/app/helpers/docs_helper.rb +3807 -0
- data/app/helpers/m9sh/toast_helper.rb +46 -0
- data/app/helpers/m9sh_helper.rb +343 -0
- data/app/javascript/application.js +3 -0
- data/app/javascript/controllers/application.js +9 -0
- data/app/javascript/controllers/backdrop_controller.js +137 -0
- data/app/javascript/controllers/color_customizer_controller.js +569 -0
- data/app/javascript/controllers/color_theme_controller.js +120 -0
- data/app/javascript/controllers/docs/component_preview_controller.js +149 -0
- data/app/javascript/controllers/docs/copy_button_controller.js +20 -0
- data/app/javascript/controllers/index.js +6 -0
- data/app/javascript/controllers/theme_controller.js +23 -0
- data/app/views/blocks/_sidebar.html.erb +31 -0
- data/app/views/blocks/_toc.html.erb +29 -0
- data/app/views/blocks/examples/dashboard-01.html.erb +180 -0
- data/app/views/blocks/examples/dashboard-02.html.erb +190 -0
- data/app/views/blocks/examples/dashboard-03.html.erb +210 -0
- data/app/views/blocks/examples/settings-01.html.erb +220 -0
- data/app/views/blocks/examples/settings-02.html.erb +231 -0
- data/app/views/blocks/examples/settings-03.html.erb +340 -0
- data/app/views/blocks/index.html.erb +65 -0
- data/app/views/docs/_sidebar.html.erb +47 -0
- data/app/views/docs/_toc.html.erb +19 -0
- data/app/views/docs/about.html.erb +68 -0
- data/app/views/docs/components/accordion.html.erb +196 -0
- data/app/views/docs/components/alert.html.erb +272 -0
- data/app/views/docs/components/alert_dialog.html.erb +232 -0
- data/app/views/docs/components/avatar.html.erb +207 -0
- data/app/views/docs/components/badge.html.erb +145 -0
- data/app/views/docs/components/breadcrumb.html.erb +264 -0
- data/app/views/docs/components/button.html.erb +229 -0
- data/app/views/docs/components/card.html.erb +378 -0
- data/app/views/docs/components/checkbox.html.erb +212 -0
- data/app/views/docs/components/collapsible.html.erb +252 -0
- data/app/views/docs/components/dialog.html.erb +323 -0
- data/app/views/docs/components/dropdown_menu.html.erb +289 -0
- data/app/views/docs/components/hover_card.html.erb +220 -0
- data/app/views/docs/components/input.html.erb +254 -0
- data/app/views/docs/components/label.html.erb +128 -0
- data/app/views/docs/components/main.html.erb +352 -0
- data/app/views/docs/components/navbar.html.erb +394 -0
- data/app/views/docs/components/navigation_menu.html.erb +226 -0
- data/app/views/docs/components/popover.html.erb +267 -0
- data/app/views/docs/components/progress.html.erb +107 -0
- data/app/views/docs/components/radio_group.html.erb +209 -0
- data/app/views/docs/components/select.html.erb +260 -0
- data/app/views/docs/components/separator.html.erb +162 -0
- data/app/views/docs/components/sheet.html.erb +270 -0
- data/app/views/docs/components/sidebar.html.erb +597 -0
- data/app/views/docs/components/skeleton.html.erb +150 -0
- data/app/views/docs/components/slider.html.erb +218 -0
- data/app/views/docs/components/spinner.html.erb +132 -0
- data/app/views/docs/components/switch.html.erb +148 -0
- data/app/views/docs/components/table.html.erb +259 -0
- data/app/views/docs/components/tabs.html.erb +225 -0
- data/app/views/docs/components/textarea.html.erb +239 -0
- data/app/views/docs/components/theme_toggle.html.erb +135 -0
- data/app/views/docs/components/toast.html.erb +205 -0
- data/app/views/docs/components/toaster.html.erb +227 -0
- data/app/views/docs/components/toggle.html.erb +154 -0
- data/app/views/docs/components/tooltip.html.erb +216 -0
- data/app/views/docs/components/typography.html.erb +180 -0
- data/app/views/docs/index.html.erb +143 -0
- data/app/views/docs/installation.html.erb +155 -0
- data/app/views/docs/simple_test.html.erb +13 -0
- data/app/views/docs/test_accordion.html.erb +14 -0
- data/app/views/docs/usage.html.erb +272 -0
- data/app/views/layouts/application.html.erb +107 -0
- data/app/views/layouts/backdrop.html.erb +77 -0
- data/app/views/shared/_app_navbar.html.erb +240 -0
- data/app/views/shared/_navbar.html.erb +69 -0
- data/app/views/showcase/v2/_components_grid.html.erb +38 -0
- data/app/views/showcase/v2/_features.html.erb +59 -0
- data/app/views/showcase/v2/_forms.html.erb +195 -0
- data/app/views/showcase/v2/_hero.html.erb +55 -0
- data/app/views/showcase/v2/_metrics.html.erb +107 -0
- data/app/views/showcase/v2.html.erb +18 -0
- data/lib/m9sh/version.rb +1 -1
- data/m9sh.gemspec +1 -1
- metadata +120 -1
@@ -0,0 +1,180 @@
|
|
1
|
+
<%= render Docs::ComponentPageComponent.new(title: "Typography") do |page| %>
|
2
|
+
<% page.with_header(
|
3
|
+
name: "Typography",
|
4
|
+
description: "Styles for headings, paragraphs, lists, and other text elements."
|
5
|
+
) %>
|
6
|
+
|
7
|
+
<% page.with_installation(component_name: "typography") %>
|
8
|
+
|
9
|
+
<% page.with_usage do %>
|
10
|
+
<%= render Docs::CodeBlockComponent.new(
|
11
|
+
code: typography_usage_code,
|
12
|
+
language: "erb"
|
13
|
+
) %>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<% page.with_examples do %>
|
17
|
+
<!-- Headings Example -->
|
18
|
+
<% headings_html = capture do %>
|
19
|
+
<div class="space-y-4">
|
20
|
+
<%= render M9sh::TypographyComponent.new(variant: :h1) do %>
|
21
|
+
Taxing Laughter: The Joke Tax Chronicles
|
22
|
+
<% end %>
|
23
|
+
<%= render M9sh::TypographyComponent.new(variant: :h2) do %>
|
24
|
+
The People of the Kingdom
|
25
|
+
<% end %>
|
26
|
+
<%= render M9sh::TypographyComponent.new(variant: :h3) do %>
|
27
|
+
The Joke Tax
|
28
|
+
<% end %>
|
29
|
+
<%= render M9sh::TypographyComponent.new(variant: :h4) do %>
|
30
|
+
People stopped telling jokes
|
31
|
+
<% end %>
|
32
|
+
</div>
|
33
|
+
<% end %>
|
34
|
+
|
35
|
+
<%= render Docs::ComponentPreviewComponent.new(
|
36
|
+
title: "Headings",
|
37
|
+
preview_content: headings_html,
|
38
|
+
code: typography_headings_code,
|
39
|
+
ai_command: typography_headings_code
|
40
|
+
) %>
|
41
|
+
|
42
|
+
<!-- Paragraph Example -->
|
43
|
+
<% paragraph_html = capture do %>
|
44
|
+
<%= render M9sh::TypographyComponent.new(variant: :p) do %>
|
45
|
+
The king, seeing how much happier his subjects were, realized the error of his ways
|
46
|
+
and repealed the joke tax.
|
47
|
+
<% end %>
|
48
|
+
<% end %>
|
49
|
+
|
50
|
+
<%= render Docs::ComponentPreviewComponent.new(
|
51
|
+
title: "Paragraph",
|
52
|
+
preview_content: paragraph_html,
|
53
|
+
code: typography_paragraph_code,
|
54
|
+
ai_command: typography_paragraph_code
|
55
|
+
) %>
|
56
|
+
|
57
|
+
<!-- Blockquote Example -->
|
58
|
+
<% blockquote_html = capture do %>
|
59
|
+
<%= render M9sh::TypographyComponent.new(variant: :blockquote) do %>
|
60
|
+
"After all," he said, "everyone enjoys a good joke, so it's only fair that they should
|
61
|
+
pay for the privilege."
|
62
|
+
<% end %>
|
63
|
+
<% end %>
|
64
|
+
|
65
|
+
<%= render Docs::ComponentPreviewComponent.new(
|
66
|
+
title: "Blockquote",
|
67
|
+
preview_content: blockquote_html,
|
68
|
+
code: typography_blockquote_code,
|
69
|
+
ai_command: typography_blockquote_code
|
70
|
+
) %>
|
71
|
+
|
72
|
+
<!-- List Example -->
|
73
|
+
<% list_html = capture do %>
|
74
|
+
<%= render M9sh::TypographyComponent.new(variant: :list) do %>
|
75
|
+
<li>1st level of puns: 5 gold coins</li>
|
76
|
+
<li>2nd level of jokes: 10 gold coins</li>
|
77
|
+
<li>3rd level of one-liners: 20 gold coins</li>
|
78
|
+
<% end %>
|
79
|
+
<% end %>
|
80
|
+
|
81
|
+
<%= render Docs::ComponentPreviewComponent.new(
|
82
|
+
title: "List",
|
83
|
+
preview_content: list_html,
|
84
|
+
code: typography_list_code,
|
85
|
+
ai_command: typography_list_code
|
86
|
+
) %>
|
87
|
+
|
88
|
+
<!-- Inline Code Example -->
|
89
|
+
<% inline_code_html = capture do %>
|
90
|
+
<p class="leading-7">
|
91
|
+
Install the <%= render M9sh::TypographyComponent.new(variant: :inline_code) do %>@radix-ui/react-alert-dialog<% end %> package.
|
92
|
+
</p>
|
93
|
+
<% end %>
|
94
|
+
|
95
|
+
<%= render Docs::ComponentPreviewComponent.new(
|
96
|
+
title: "Inline Code",
|
97
|
+
preview_content: inline_code_html,
|
98
|
+
code: typography_inline_code_code,
|
99
|
+
ai_command: typography_inline_code_code
|
100
|
+
) %>
|
101
|
+
|
102
|
+
<!-- Lead Example -->
|
103
|
+
<% lead_html = capture do %>
|
104
|
+
<%= render M9sh::TypographyComponent.new(variant: :lead) do %>
|
105
|
+
A modal dialog that interrupts the user with important content and expects a response.
|
106
|
+
<% end %>
|
107
|
+
<% end %>
|
108
|
+
|
109
|
+
<%= render Docs::ComponentPreviewComponent.new(
|
110
|
+
title: "Lead Text",
|
111
|
+
preview_content: lead_html,
|
112
|
+
code: typography_lead_code,
|
113
|
+
ai_command: typography_lead_code
|
114
|
+
) %>
|
115
|
+
|
116
|
+
<!-- Text Variants Example -->
|
117
|
+
<% variants_html = capture do %>
|
118
|
+
<div class="space-y-4">
|
119
|
+
<%= render M9sh::TypographyComponent.new(variant: :large) do %>
|
120
|
+
Are you absolutely sure?
|
121
|
+
<% end %>
|
122
|
+
<%= render M9sh::TypographyComponent.new(variant: :small) do %>
|
123
|
+
Email address
|
124
|
+
<% end %>
|
125
|
+
<%= render M9sh::TypographyComponent.new(variant: :muted) do %>
|
126
|
+
Enter your email address.
|
127
|
+
<% end %>
|
128
|
+
</div>
|
129
|
+
<% end %>
|
130
|
+
|
131
|
+
<%= render Docs::ComponentPreviewComponent.new(
|
132
|
+
title: "Text Variants",
|
133
|
+
preview_content: variants_html,
|
134
|
+
code: typography_variants_code,
|
135
|
+
ai_command: typography_variants_code
|
136
|
+
) %>
|
137
|
+
<% end %>
|
138
|
+
|
139
|
+
<% page.with_api do %>
|
140
|
+
<%= render Docs::PropTableComponent.new(
|
141
|
+
props: [
|
142
|
+
{
|
143
|
+
name: "variant",
|
144
|
+
type: "Symbol",
|
145
|
+
default: ":p",
|
146
|
+
description: "The typography style. Options: :h1, :h2, :h3, :h4, :p, :blockquote, :list, :inline_code, :lead, :large, :small, :muted"
|
147
|
+
},
|
148
|
+
{
|
149
|
+
name: "tag",
|
150
|
+
type: "Symbol",
|
151
|
+
default: "nil",
|
152
|
+
description: "Override the default HTML tag for the variant. By default, each variant uses an appropriate semantic tag."
|
153
|
+
}
|
154
|
+
]
|
155
|
+
) %>
|
156
|
+
|
157
|
+
<div class="mt-6 space-y-3 text-sm">
|
158
|
+
<h3 class="text-lg font-semibold">Default Tags</h3>
|
159
|
+
<ul class="list-disc list-inside space-y-1 text-muted-foreground">
|
160
|
+
<li><code class="text-xs bg-muted px-1 py-0.5 rounded">:h1</code>, <code class="text-xs bg-muted px-1 py-0.5 rounded">:h2</code>, <code class="text-xs bg-muted px-1 py-0.5 rounded">:h3</code>, <code class="text-xs bg-muted px-1 py-0.5 rounded">:h4</code> - Use their corresponding heading tags</li>
|
161
|
+
<li><code class="text-xs bg-muted px-1 py-0.5 rounded">:p</code>, <code class="text-xs bg-muted px-1 py-0.5 rounded">:lead</code>, <code class="text-xs bg-muted px-1 py-0.5 rounded">:muted</code> - Use <code class="text-xs bg-muted px-1 py-0.5 rounded"><p></code> tag</li>
|
162
|
+
<li><code class="text-xs bg-muted px-1 py-0.5 rounded">:blockquote</code> - Uses <code class="text-xs bg-muted px-1 py-0.5 rounded"><blockquote></code> tag</li>
|
163
|
+
<li><code class="text-xs bg-muted px-1 py-0.5 rounded">:list</code> - Uses <code class="text-xs bg-muted px-1 py-0.5 rounded"><ul></code> tag</li>
|
164
|
+
<li><code class="text-xs bg-muted px-1 py-0.5 rounded">:inline_code</code> - Uses <code class="text-xs bg-muted px-1 py-0.5 rounded"><code></code> tag</li>
|
165
|
+
<li><code class="text-xs bg-muted px-1 py-0.5 rounded">:small</code> - Uses <code class="text-xs bg-muted px-1 py-0.5 rounded"><small></code> tag</li>
|
166
|
+
<li><code class="text-xs bg-muted px-1 py-0.5 rounded">:large</code> - Uses <code class="text-xs bg-muted px-1 py-0.5 rounded"><div></code> tag</li>
|
167
|
+
</ul>
|
168
|
+
</div>
|
169
|
+
|
170
|
+
<div class="mt-6 space-y-3 text-sm">
|
171
|
+
<h3 class="text-lg font-semibold">Notes</h3>
|
172
|
+
<ul class="list-disc list-inside space-y-1 text-muted-foreground">
|
173
|
+
<li>The Typography component provides consistent styling for text elements across your application</li>
|
174
|
+
<li>Each variant uses appropriate semantic HTML tags by default, but can be overridden with the <code class="text-xs bg-muted px-1 py-0.5 rounded">tag</code> parameter</li>
|
175
|
+
<li>The component automatically applies proper spacing, sizing, and styling based on the variant</li>
|
176
|
+
<li>Use <code class="text-xs bg-muted px-1 py-0.5 rounded">:lead</code> for introductory paragraphs and <code class="text-xs bg-muted px-1 py-0.5 rounded">:muted</code> for secondary text</li>
|
177
|
+
</ul>
|
178
|
+
</div>
|
179
|
+
<% end %>
|
180
|
+
<% end %>
|
@@ -0,0 +1,143 @@
|
|
1
|
+
<% content_for :title, "Introduction - m9sh/ui" %>
|
2
|
+
|
3
|
+
<div class="space-y-12">
|
4
|
+
<!-- Hero Section -->
|
5
|
+
<div class="space-y-6 py-8">
|
6
|
+
<div class="space-y-4">
|
7
|
+
<h1 class="scroll-m-20 text-5xl font-bold tracking-tight lg:text-6xl">
|
8
|
+
Build faster with m9sh/ui
|
9
|
+
</h1>
|
10
|
+
<p class="text-xl text-muted-foreground max-w-[700px]">
|
11
|
+
Beautifully designed components based on shadcn/ui that you can copy and paste into your Rails applications.
|
12
|
+
Accessible. Customizable. Open Source.
|
13
|
+
</p>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<div class="flex gap-4 pt-4">
|
17
|
+
<%= link_to docs_installation_path do %>
|
18
|
+
<%= render M9sh::ButtonComponent.new(size: :lg) do %>
|
19
|
+
Get Started
|
20
|
+
<% end %>
|
21
|
+
<% end %>
|
22
|
+
<%= link_to docs_component_path('accordion') do %>
|
23
|
+
<%= render M9sh::ButtonComponent.new(variant: :outline, size: :lg) do %>
|
24
|
+
Browse Components
|
25
|
+
<% end %>
|
26
|
+
<% end %>
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
|
30
|
+
<!-- Key Points -->
|
31
|
+
<div class="space-y-8">
|
32
|
+
<div>
|
33
|
+
<h2 class="scroll-m-20 pb-2 text-3xl font-semibold tracking-tight transition-colors">
|
34
|
+
What is m9sh/ui?
|
35
|
+
</h2>
|
36
|
+
<%= render M9sh::SeparatorComponent.new(class: "my-4") %>
|
37
|
+
<p class="mt-4 text-muted-foreground leading-7">
|
38
|
+
This is NOT a component library. It's a collection of re-usable ViewComponents that you can copy and paste into your Rails apps.
|
39
|
+
</p>
|
40
|
+
<p class="mt-4 text-muted-foreground leading-7">
|
41
|
+
Pick the components you need. Copy the code into your project and customize to your needs. The code is yours.
|
42
|
+
</p>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div>
|
46
|
+
<h2 class="scroll-m-20 pb-2 text-3xl font-semibold tracking-tight transition-colors">
|
47
|
+
Philosophy
|
48
|
+
</h2>
|
49
|
+
<%= render M9sh::SeparatorComponent.new(class: "my-4") %>
|
50
|
+
<p class="mt-4 text-muted-foreground leading-7">
|
51
|
+
The idea behind this is to give you ownership and control over the code, allowing you to decide how the components are built and styled.
|
52
|
+
</p>
|
53
|
+
<p class="mt-4 text-muted-foreground leading-7">
|
54
|
+
Start with some sensible defaults, then customize the components to your needs.
|
55
|
+
</p>
|
56
|
+
<p class="mt-4 text-muted-foreground leading-7">
|
57
|
+
One of the drawbacks of packaging the components in a gem is that the style is coupled with the implementation. The design of your components should be separate from their implementation.
|
58
|
+
</p>
|
59
|
+
</div>
|
60
|
+
|
61
|
+
<!-- Features Grid -->
|
62
|
+
<div>
|
63
|
+
<h2 class="scroll-m-20 pb-2 text-3xl font-semibold tracking-tight transition-colors">
|
64
|
+
Features
|
65
|
+
</h2>
|
66
|
+
<%= render M9sh::SeparatorComponent.new(class: "my-4") %>
|
67
|
+
<div class="mt-6 grid gap-6 sm:grid-cols-2">
|
68
|
+
<%= render M9sh::CardComponent.new(class: "space-y-2") do |card| %>
|
69
|
+
<% card.with_header do %>
|
70
|
+
<h3 class="font-semibold">Accessible</h3>
|
71
|
+
<% end %>
|
72
|
+
<% card.with_body do %>
|
73
|
+
<p class="text-sm text-muted-foreground">
|
74
|
+
Built with accessibility in mind. Components follow WAI-ARIA design patterns and support keyboard navigation.
|
75
|
+
</p>
|
76
|
+
<% end %>
|
77
|
+
<% end %>
|
78
|
+
|
79
|
+
<%= render M9sh::CardComponent.new(class: "space-y-2") do |card| %>
|
80
|
+
<% card.with_header do %>
|
81
|
+
<h3 class="font-semibold">Customizable</h3>
|
82
|
+
<% end %>
|
83
|
+
<% card.with_body do %>
|
84
|
+
<p class="text-sm text-muted-foreground">
|
85
|
+
Full control over styling. Copy the code and modify it to match your design system.
|
86
|
+
</p>
|
87
|
+
<% end %>
|
88
|
+
<% end %>
|
89
|
+
|
90
|
+
<%= render M9sh::CardComponent.new(class: "space-y-2") do |card| %>
|
91
|
+
<% card.with_header do %>
|
92
|
+
<h3 class="font-semibold">ViewComponent</h3>
|
93
|
+
<% end %>
|
94
|
+
<% card.with_body do %>
|
95
|
+
<p class="text-sm text-muted-foreground">
|
96
|
+
Built with ViewComponent for Rails. Testable, reusable, and follows Rails conventions.
|
97
|
+
</p>
|
98
|
+
<% end %>
|
99
|
+
<% end %>
|
100
|
+
|
101
|
+
<%= render M9sh::CardComponent.new(class: "space-y-2") do |card| %>
|
102
|
+
<% card.with_header do %>
|
103
|
+
<h3 class="font-semibold">Modern Stack</h3>
|
104
|
+
<% end %>
|
105
|
+
<% card.with_body do %>
|
106
|
+
<p class="text-sm text-muted-foreground">
|
107
|
+
Uses Tailwind CSS for styling and Stimulus for JavaScript interactions.
|
108
|
+
</p>
|
109
|
+
<% end %>
|
110
|
+
<% end %>
|
111
|
+
</div>
|
112
|
+
</div>
|
113
|
+
|
114
|
+
<div>
|
115
|
+
<h2 class="scroll-m-20 pb-2 text-3xl font-semibold tracking-tight transition-colors">
|
116
|
+
FAQ
|
117
|
+
</h2>
|
118
|
+
<%= render M9sh::SeparatorComponent.new(class: "my-4") %>
|
119
|
+
<div class="mt-6 space-y-6">
|
120
|
+
<div>
|
121
|
+
<h3 class="font-semibold">Why Rails ViewComponents?</h3>
|
122
|
+
<p class="mt-2 text-sm text-muted-foreground leading-7">
|
123
|
+
ViewComponents provide a Ruby-native way to build reusable, testable view components in Rails. They integrate seamlessly with your Rails application and Stimulus controllers.
|
124
|
+
</p>
|
125
|
+
</div>
|
126
|
+
|
127
|
+
<div>
|
128
|
+
<h3 class="font-semibold">Do I need to install a gem?</h3>
|
129
|
+
<p class="mt-2 text-sm text-muted-foreground leading-7">
|
130
|
+
No. Simply browse the components in the sidebar, copy the code, and paste it into your Rails application. The code is yours to customize.
|
131
|
+
</p>
|
132
|
+
</div>
|
133
|
+
|
134
|
+
<div>
|
135
|
+
<h3 class="font-semibold">Can I use this in my project?</h3>
|
136
|
+
<p class="mt-2 text-sm text-muted-foreground leading-7">
|
137
|
+
Yes. Free to use for personal and commercial projects. No attribution required.
|
138
|
+
</p>
|
139
|
+
</div>
|
140
|
+
</div>
|
141
|
+
</div>
|
142
|
+
</div>
|
143
|
+
</div>
|
@@ -0,0 +1,155 @@
|
|
1
|
+
<% content_for :title, "Installation - m9sh/ui" %>
|
2
|
+
|
3
|
+
<div class="space-y-12 max-w-3xl">
|
4
|
+
<!-- Page Header -->
|
5
|
+
<div class="space-y-4">
|
6
|
+
<h1 class="scroll-m-20 text-4xl font-bold tracking-tight lg:text-5xl">
|
7
|
+
Installation
|
8
|
+
</h1>
|
9
|
+
<p class="text-lg text-muted-foreground">
|
10
|
+
How to install dependencies and structure your app.
|
11
|
+
</p>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<!-- Requirements -->
|
15
|
+
<div class="space-y-6">
|
16
|
+
<div>
|
17
|
+
<h2 class="scroll-m-20 pb-2 text-3xl font-semibold tracking-tight transition-colors">
|
18
|
+
Requirements
|
19
|
+
</h2>
|
20
|
+
<%= render M9sh::SeparatorComponent.new(class: "my-4") %>
|
21
|
+
<p class="mt-4 text-muted-foreground leading-7">
|
22
|
+
This project requires the following dependencies:
|
23
|
+
</p>
|
24
|
+
<ul class="mt-4 ml-6 list-disc text-muted-foreground leading-7 space-y-2">
|
25
|
+
<li>Ruby on Rails 7.0 or higher</li>
|
26
|
+
<li>view_component gem</li>
|
27
|
+
<li>Tailwind CSS</li>
|
28
|
+
<li>Stimulus (for interactive components)</li>
|
29
|
+
</ul>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<!-- Install ViewComponent -->
|
33
|
+
<div>
|
34
|
+
<h2 class="scroll-m-20 pb-2 text-3xl font-semibold tracking-tight transition-colors">
|
35
|
+
Install ViewComponent
|
36
|
+
</h2>
|
37
|
+
<%= render M9sh::SeparatorComponent.new(class: "my-4") %>
|
38
|
+
<p class="mt-4 text-muted-foreground leading-7">
|
39
|
+
Add the view_component gem to your Gemfile:
|
40
|
+
</p>
|
41
|
+
<%= render Docs::CodeBlockComponent.new(
|
42
|
+
code: 'gem "view_component"',
|
43
|
+
language: "ruby"
|
44
|
+
) %>
|
45
|
+
<p class="mt-4 text-muted-foreground leading-7">
|
46
|
+
Then run:
|
47
|
+
</p>
|
48
|
+
<%= render Docs::CodeBlockComponent.new(
|
49
|
+
code: 'bundle install',
|
50
|
+
language: "bash"
|
51
|
+
) %>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
<!-- Configure Tailwind CSS -->
|
55
|
+
<div>
|
56
|
+
<h2 class="scroll-m-20 pb-2 text-3xl font-semibold tracking-tight transition-colors">
|
57
|
+
Configure Tailwind CSS
|
58
|
+
</h2>
|
59
|
+
<%= render M9sh::SeparatorComponent.new(class: "my-4") %>
|
60
|
+
<p class="mt-4 text-muted-foreground leading-7">
|
61
|
+
This project uses Tailwind CSS. If you don't have it installed yet, follow the official Rails + Tailwind CSS installation guide.
|
62
|
+
</p>
|
63
|
+
<p class="mt-4 text-muted-foreground leading-7">
|
64
|
+
Make sure your <%= render M9sh::BadgeComponent.new(variant: :secondary) do %>tailwind.config.js<% end %> includes the components directory:
|
65
|
+
</p>
|
66
|
+
<%= render Docs::CodeBlockComponent.new(
|
67
|
+
code: <<~JS,
|
68
|
+
module.exports = {
|
69
|
+
content: [
|
70
|
+
'./app/components/**/*.{rb,erb}',
|
71
|
+
'./app/views/**/*.{erb,html}',
|
72
|
+
'./app/helpers/**/*.rb',
|
73
|
+
'./app/javascript/**/*.js'
|
74
|
+
]
|
75
|
+
}
|
76
|
+
JS
|
77
|
+
language: "javascript"
|
78
|
+
) %>
|
79
|
+
</div>
|
80
|
+
|
81
|
+
<!-- Install M9sh CLI -->
|
82
|
+
<div>
|
83
|
+
<h2 class="scroll-m-20 pb-2 text-3xl font-semibold tracking-tight transition-colors">
|
84
|
+
Install M9sh CLI (Recommended)
|
85
|
+
</h2>
|
86
|
+
<%= render M9sh::SeparatorComponent.new(class: "my-4") %>
|
87
|
+
<p class="mt-4 text-muted-foreground leading-7">
|
88
|
+
The easiest way to add components is using the M9sh CLI. Install it globally:
|
89
|
+
</p>
|
90
|
+
<%= render Docs::CodeBlockComponent.new(
|
91
|
+
code: 'gem install m9sh',
|
92
|
+
language: "bash"
|
93
|
+
) %>
|
94
|
+
<p class="mt-4 text-muted-foreground leading-7">
|
95
|
+
Initialize M9sh in your project:
|
96
|
+
</p>
|
97
|
+
<%= render Docs::CodeBlockComponent.new(
|
98
|
+
code: 'm9sh init',
|
99
|
+
language: "bash"
|
100
|
+
) %>
|
101
|
+
<p class="mt-4 text-muted-foreground leading-7">
|
102
|
+
Add components with automatic dependency resolution:
|
103
|
+
</p>
|
104
|
+
<%= render Docs::CodeBlockComponent.new(
|
105
|
+
code: <<~BASH,
|
106
|
+
# Add a single component
|
107
|
+
m9sh add button
|
108
|
+
|
109
|
+
# Add multiple components
|
110
|
+
m9sh add card dialog tabs
|
111
|
+
|
112
|
+
# Add all components
|
113
|
+
m9sh add --all
|
114
|
+
BASH
|
115
|
+
language: "bash"
|
116
|
+
) %>
|
117
|
+
<p class="mt-4 text-muted-foreground leading-7">
|
118
|
+
List available components:
|
119
|
+
</p>
|
120
|
+
<%= render Docs::CodeBlockComponent.new(
|
121
|
+
code: 'm9sh list',
|
122
|
+
language: "bash"
|
123
|
+
) %>
|
124
|
+
</div>
|
125
|
+
|
126
|
+
<!-- Manual Installation -->
|
127
|
+
<div>
|
128
|
+
<h2 class="scroll-m-20 pb-2 text-3xl font-semibold tracking-tight transition-colors">
|
129
|
+
Manual Installation
|
130
|
+
</h2>
|
131
|
+
<%= render M9sh::SeparatorComponent.new(class: "my-4") %>
|
132
|
+
<p class="mt-4 text-muted-foreground leading-7">
|
133
|
+
Alternatively, you can manually copy and paste component code from the documentation pages.
|
134
|
+
</p>
|
135
|
+
<p class="mt-4 text-muted-foreground leading-7">
|
136
|
+
Components should be placed in:
|
137
|
+
</p>
|
138
|
+
<ul class="mt-4 ml-6 list-disc text-muted-foreground leading-7 space-y-2">
|
139
|
+
<li><%= render M9sh::BadgeComponent.new(variant: :secondary) do %>app/components/m9sh/<% end %> for Ruby component files</li>
|
140
|
+
<li><%= render M9sh::BadgeComponent.new(variant: :secondary) do %>app/javascript/controllers/m9sh/<% end %> for Stimulus controllers</li>
|
141
|
+
</ul>
|
142
|
+
</div>
|
143
|
+
|
144
|
+
<!-- That's it! -->
|
145
|
+
<div>
|
146
|
+
<h2 class="scroll-m-20 pb-2 text-3xl font-semibold tracking-tight transition-colors">
|
147
|
+
That's it!
|
148
|
+
</h2>
|
149
|
+
<%= render M9sh::SeparatorComponent.new(class: "my-4") %>
|
150
|
+
<p class="mt-4 text-muted-foreground leading-7">
|
151
|
+
You can now start using the components in your Rails application. Each component page includes usage examples and code snippets.
|
152
|
+
</p>
|
153
|
+
</div>
|
154
|
+
</div>
|
155
|
+
</div>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<h1>Simple Test</h1>
|
2
|
+
|
3
|
+
<% component = M9sh::AccordionComponent.new(type: "single", collapsible: true) %>
|
4
|
+
<% component.with_item(value: "test-1") do |item| %>
|
5
|
+
<% item.with_trigger do %>
|
6
|
+
Trigger Text
|
7
|
+
<% end %>
|
8
|
+
<% item.with_body do %>
|
9
|
+
Body Text
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<%= render component %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<h1>Test Accordion</h1>
|
2
|
+
|
3
|
+
<div class="p-8">
|
4
|
+
<%= render M9sh::AccordionComponent.new(type: "single", collapsible: true) do |accordion| %>
|
5
|
+
<% accordion.with_item(value: "test-1") do |item| %>
|
6
|
+
<% item.with_trigger do %>
|
7
|
+
Test Question 1
|
8
|
+
<% end %>
|
9
|
+
<% item.with_body do %>
|
10
|
+
Test Answer 1
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|
14
|
+
</div>
|