Skip to content

Commit 5e9a922

Browse files
authored
Adjust website to reflect shadcn inspiration (#377)
1 parent 6102ec1 commit 5e9a922

File tree

4 files changed

+142
-56
lines changed

4 files changed

+142
-56
lines changed

app/views/docs/getting_started/customizing_components.rb

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,50 @@ def view_template
8888
end
8989
end
9090
end
91+
92+
div(class: "space-y-4") do
93+
Heading(level: 2) { "Learning from shadcn/ui" }
94+
Text do
95+
plain "RubyUI components are inspired by "
96+
InlineLink(href: "https://ui.shadcn.com") { "shadcn/ui" }
97+
plain ", which has an extensive collection of beautifully designed components. When customizing RubyUI components, we recommend checking the "
98+
InlineLink(href: "https://ui.shadcn.com/docs/components") { "shadcn/ui component documentation" }
99+
plain " for reference on Tailwind CSS class implementations."
100+
end
101+
Text do
102+
plain "shadcn/ui provides excellent examples of:"
103+
end
104+
Components.TypographyList do
105+
Components.TypographyListItem { "Tailwind CSS class patterns for common UI elements" }
106+
Components.TypographyListItem { "Accessibility best practices" }
107+
Components.TypographyListItem { "Responsive design patterns" }
108+
Components.TypographyListItem { "Dark mode implementations" }
109+
end
110+
end
111+
112+
div(class: "space-y-4") do
113+
Heading(level: 2) { "Contributing new components" }
114+
Text do
115+
plain "If you've implemented a component locally that exists in "
116+
InlineLink(href: "https://ui.shadcn.com/docs/components") { "shadcn/ui" }
117+
plain " but isn't yet available in RubyUI, we'd love for you to contribute it back to the community!"
118+
end
119+
Text do
120+
plain "To contribute a new component:"
121+
end
122+
Components.TypographyList(numbered: true) do
123+
Components.TypographyListItem do
124+
plain "Check the "
125+
InlineLink(href: "https://github.com/PhlexUI/phlex_ui") { "RubyUI GitHub repository" }
126+
plain " to see if the component is already planned"
127+
end
128+
Components.TypographyListItem { "Open an issue or discussion to propose the new component" }
129+
Components.TypographyListItem { "Submit a pull request with your implementation" }
130+
end
131+
Text do
132+
plain "By contributing, you help expand the RubyUI ecosystem and make it easier for other Ruby developers to build beautiful interfaces."
133+
end
134+
end
91135
end
92136
end
93137

app/views/docs/getting_started/introduction.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,32 @@ def view_template
3737
end
3838
end
3939

40+
div(class: "space-y-4") do
41+
Heading(level: 2) { "Design inspiration" }
42+
Text do
43+
plain "RubyUI's component designs are heavily inspired by "
44+
InlineLink(href: "https://ui.shadcn.com") { "shadcn/ui" }
45+
plain ", a beautifully designed collection of React components built on Tailwind CSS. shadcn/ui describes itself as \"The Foundation for your Design System\" - a set of components you can customize, extend, and make your own."
46+
end
47+
Text do
48+
plain "We borrow design patterns, component APIs, and Tailwind CSS classes from shadcn/ui, bringing the same beautiful aesthetic to Ruby developers. This means:"
49+
end
50+
Components.TypographyList do
51+
Components.TypographyListItem do
52+
span(class: "font-medium") { "Same visual design " }
53+
plain "- Components look and feel like their shadcn/ui counterparts"
54+
end
55+
Components.TypographyListItem do
56+
span(class: "font-medium") { "Compatible theming " }
57+
plain "- Use the same CSS variables and copy themes directly from shadcn/ui"
58+
end
59+
Components.TypographyListItem do
60+
span(class: "font-medium") { "Familiar patterns " }
61+
plain "- If you've used shadcn/ui, you'll feel right at home"
62+
end
63+
end
64+
end
65+
4066
div(class: "space-y-4") do
4167
Heading(level: 2) { "Why I built RubyUI" }
4268
Text do
@@ -101,6 +127,10 @@ def view_template
101127
InlineLink(href: "https://phlex.fun") { "Phlex" }
102128
plain " - The foundation of RubyUI."
103129
end
130+
Components.TypographyListItem do
131+
InlineLink(href: "https://ui.shadcn.com") { "shadcn/ui" }
132+
plain " - The design inspiration for RubyUI's components and theming system."
133+
end
104134
Components.TypographyListItem do
105135
InlineLink(href: "https://stimulus.hotwired.dev") { "Stimulus JS" }
106136
plain " - A quicker way to write JavaScript."

app/views/docs/getting_started/theming.rb

Lines changed: 67 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ def view_template
88
div(class: "space-y-4") do
99
Components.Heading(level: 2) { "Introduction" }
1010
Text do
11-
plain "Phlex UI uses CSS Variables like "
12-
InlineCode { "--primary: 0 0% 9%" }
13-
plain " for theming. This allows you to easily customize the look and feel of your application."
11+
plain "RubyUI uses CSS Variables like "
12+
InlineCode { "--primary: oklch(0.205 0 0)" }
13+
plain " for theming. This approach is inspired by "
14+
InlineLink(href: "https://ui.shadcn.com") { "shadcn/ui" }
15+
plain " and allows you to easily customize the look and feel of your application."
1416
end
1517
# List the 2 benefits. That we can use CSS variables to change the style, without changing the tailwindcss classes used
1618
# And that we can change the style of a particular tailwindcss class for both light and dark mode, without having to duplicate the tailwindcss class
@@ -60,19 +62,19 @@ def view_template
6062
end
6163
Text { "Given the following CSS variables:" }
6264
code = <<~CODE
63-
--primary: 222.2 47.4% 11.2%;
64-
--primary-foreground: 210 40% 98%;
65+
--primary: oklch(0.205 0 0);
66+
--primary-foreground: oklch(0.985 0 0);
6567
CODE
6668
Codeblock(code, syntax: :css)
6769
Text do
6870
plain "The "
6971
InlineCode { "background" }
7072
plain " color of the following component will be "
71-
InlineCode { "hsl(var(--primary))" }
73+
InlineCode { "var(--primary)" }
7274
plain " and the "
7375
InlineCode { "foreground" }
7476
plain " color will be "
75-
InlineCode { "hsl(var(--primary-foreground))" }
77+
InlineCode { "var(--primary-foreground)" }
7678
plain "."
7779
end
7880
code = <<~CODE
@@ -81,8 +83,8 @@ def view_template
8183
Codeblock(code, syntax: :html)
8284
Alert(class: "bg-transparent") do
8385
AlertDescription do
84-
span(class: "font-medium") { "CSS variables must be defined without color space function" }
85-
plain ". See the "
86+
span(class: "font-medium") { "RubyUI uses oklch color format" }
87+
plain ", the same format used by shadcn/ui. See the "
8688
InlineLink(href: "https://tailwindcss.com/docs/customizing-colors#using-css-variables") { "Tailwind CSS documentation" }
8789
plain " for more information."
8890
end
@@ -110,26 +112,42 @@ def view_template
110112
end
111113

112114
div(class: "space-y-4") do
113-
Heading(level: 2) { "Other color formats" }
115+
Heading(level: 2) { "Color format (oklch)" }
114116
Text do
115-
plain "It's recommended to use "
116-
InlineLink(href: "https://www.smashingmagazine.com/2021/07/hsl-colors-css/") { "HSL colors" }
117-
plain " for your application. However, you can also use other color formats such as "
118-
InlineCode { "rgb" }
119-
plain " or "
120-
InlineCode { "rgba" }
121-
plain "."
117+
plain "RubyUI uses "
118+
InlineLink(href: "https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/oklch") { "oklch colors" }
119+
plain " as the default color format. This is the same format used by "
120+
InlineLink(href: "https://ui.shadcn.com") { "shadcn/ui" }
121+
plain " and provides better perceptual uniformity and wider color gamut support."
122122
end
123123
Text do
124-
plain "See "
125-
InlineLink(href: "https://tailwindcss.com/docs/customizing-colors#using-css-variables") { "Tailwind CSS documentation" }
126-
plain " for more information on how to use "
127-
InlineCode { "rgb" }
124+
plain "While "
125+
InlineCode { "oklch" }
126+
plain " is recommended, you can also use other color formats such as "
127+
InlineCode { "hsl" }
128128
plain ", "
129+
InlineCode { "rgb" }
130+
plain ", or "
129131
InlineCode { "rgba" }
130-
plain " or "
131-
InlineCode { "hsl" }
132-
plain " colors."
132+
plain ". See the "
133+
InlineLink(href: "https://tailwindcss.com/docs/customizing-colors#using-css-variables") { "Tailwind CSS documentation" }
134+
plain " for more information."
135+
end
136+
end
137+
138+
div(class: "space-y-4") do
139+
Heading(level: 2) { "shadcn/ui themes" }
140+
Text do
141+
plain "RubyUI themes use the same CSS variable convention as "
142+
InlineLink(href: "https://ui.shadcn.com") { "shadcn/ui" }
143+
plain ". This means you can copy themes directly from "
144+
InlineLink(href: "https://ui.shadcn.com/themes") { "shadcn/ui themes" }
145+
plain " and use them in your RubyUI application."
146+
end
147+
Text do
148+
plain "Visit the "
149+
InlineLink(href: "/themes/default") { "RubyUI themes page" }
150+
plain " to preview and copy themes, just like you would on shadcn/ui."
133151
end
134152
end
135153
end
@@ -139,85 +157,85 @@ def css_variables
139157
space_y_2 do
140158
Text(size: "2", weight: "medium") { "Default background color of <body>...etc" }
141159
code = <<~CODE
142-
--background: 0 0% 100%;
143-
--foreground: 222.2 47.4% 11.2%;
160+
--background: oklch(1 0 0);
161+
--foreground: oklch(0.145 0 0);
144162
CODE
145163
Codeblock(code, syntax: :css)
146164
end
147165

148166
space_y_2 do
149167
Text(size: "2", weight: "medium") { "Muted backgrounds such as TabsList" }
150168
code = <<~CODE
151-
--muted: 210 40% 96.1%;
152-
--muted-foreground: 215.4 16.3% 46.9%;
169+
--muted: oklch(0.97 0 0);
170+
--muted-foreground: oklch(0.556 0 0);
153171
CODE
154172
Codeblock(code, syntax: :css)
155173
end
156174

157175
space_y_2 do
158176
Text(size: "2", weight: "medium") { "Default border color" }
159177
code = <<~CODE
160-
--border: 214.3 31.8% 91.4%;
178+
--border: oklch(0.922 0 0);
161179
CODE
162180
Codeblock(code, syntax: :css)
163181
end
164182

165183
space_y_2 do
166184
Text(size: "2", weight: "medium") { "Border color for inputs such as Input, Select or Textarea" }
167185
code = <<~CODE
168-
--input: 214.3 31.8% 91.4%;
186+
--input: oklch(0.922 0 0);
169187
CODE
170188
Codeblock(code, syntax: :css)
171189
end
172190

173191
space_y_2 do
174192
Text(size: "2", weight: "medium") { "Primary colors for Button" }
175193
code = <<~CODE
176-
--primary: 222.2 47.4% 11.2%;
177-
--primary-foreground: 210 40% 98%;
194+
--primary: oklch(0.205 0 0);
195+
--primary-foreground: oklch(0.985 0 0);
178196
CODE
179197
Codeblock(code, syntax: :css)
180198
end
181199

182200
space_y_2 do
183201
Text(size: "2", weight: "medium") { "Secondary colors for Button" }
184202
code = <<~CODE
185-
--secondary: 210 40% 96.1%;
186-
--secondary-foreground: 222.2 47.4% 11.2%;
203+
--secondary: oklch(0.97 0 0);
204+
--secondary-foreground: oklch(0.205 0 0);
187205
CODE
188206
Codeblock(code, syntax: :css)
189207
end
190208

191209
space_y_2 do
192210
Text(size: "2", weight: "medium") { "Used for accents such as hover effects on DropdownMenu::Item, Select::Item... etc" }
193211
code = <<~CODE
194-
--accent: 210 40% 96.1%;
195-
--accent-foreground: 222.2 47.4% 11.2%;
212+
--accent: oklch(0.97 0 0);
213+
--accent-foreground: oklch(0.205 0 0);
196214
CODE
197215
Codeblock(code, syntax: :css)
198216
end
199217

200218
space_y_2 do
201219
Text(size: "2", weight: "medium") { "Used for destructive actions such as Button.new(variant: :destructive)" }
202220
code = <<~CODE
203-
--destructive: 0 100% 50%;
204-
--destructive-foreground: 210 40% 98%;
221+
--destructive: oklch(0.577 0.245 27.325);
222+
--destructive-foreground: oklch(0.577 0.245 27.325);
205223
CODE
206224
Codeblock(code, syntax: :css)
207225
end
208226

209227
space_y_2 do
210228
Text(size: "2", weight: "medium") { "Used for focus ring" }
211229
code = <<~CODE
212-
--ring: 215 20.2% 65.1%;
230+
--ring: oklch(0.708 0 0);
213231
CODE
214232
Codeblock(code, syntax: :css)
215233
end
216234

217235
space_y_2 do
218236
Text(size: "2", weight: "medium") { "Border radius for card, input and buttons" }
219237
code = <<~CODE
220-
--radius: 0.5rem;
238+
--radius: 0.625rem;
221239
CODE
222240
Codeblock(code, syntax: :css)
223241
end
@@ -231,33 +249,27 @@ def adding_a_color
231249
end
232250
code = <<~CODE
233251
:root {
234-
--contrast: 38 92% 50%;
235-
--contrast-foreground: 48 96% 89%;
252+
--contrast: oklch(0.75 0.18 85);
253+
--contrast-foreground: oklch(0.25 0.05 85);
236254
}
237255
238256
.dark {
239-
--contrast: 48 96% 89%;
240-
--contrast-foreground: 38 92% 50%;
257+
--contrast: oklch(0.85 0.15 85);
258+
--contrast-foreground: oklch(0.2 0.05 85);
241259
}
242260
CODE
243261
Codeblock(code, syntax: :css)
244262
end
245263

246264
space_y_2 do
247-
Text(size: "2", weight: "medium") { "tailwind.config.js" }
265+
Text(size: "2", weight: "medium") { "application.tailwind.css (inside @theme inline)" }
248266
code = <<~CODE
249-
module.exports = {
250-
theme: {
251-
extend: {
252-
colors: {
253-
contrast: "hsl(var(--contrast))",
254-
"contrast-foreground": "hsl(var(--contrast-foreground))",
255-
},
256-
},
257-
},
267+
@theme inline {
268+
--color-contrast: var(--contrast);
269+
--color-contrast-foreground: var(--contrast-foreground);
258270
}
259271
CODE
260-
Codeblock(code, syntax: :javascript)
272+
Codeblock(code, syntax: :css)
261273
end
262274

263275
Text do

app/views/themes/show.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def view_template
1010
div(class: "md:flex items-center justify-between") do
1111
div do
1212
Heading(level: 1) { "Themes" }
13-
Text(as: "p", size: "5", weight: "medium") { "Customize your app fast with hand-picked themes." }
13+
Text(as: "p", size: "5", weight: "medium") { "Customize your app fast with hand-picked themes. Compatible with shadcn/ui." }
1414
end
1515
div(class: "flex gap-x-2 mt-4") do
1616
render Themes::CustomizePopover.new(theme: @theme)

0 commit comments

Comments
 (0)