Skip to content

Commit ba9d8e0

Browse files
committed
Modernize examples app with Tailwind
1 parent f65ac5c commit ba9d8e0

27 files changed

Lines changed: 452 additions & 231 deletions

Gemfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ gem "propshaft"
1616

1717
gem "turbo-rails"
1818
gem "jsbundling-rails"
19+
gem "tailwindcss-rails", "~> 4.4"
1920

2021
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
2122
gem "jbuilder"
@@ -65,8 +66,8 @@ end
6566
gem "tzinfo-data", platforms: %i[windows mswin jruby]
6667

6768
# Uploadcare-rails provides unified API interface to Uploadcare API
68-
gem "uploadcare-rails", github: "uploadcare/uploadcare-rails", branch: "5-0-stable"
69-
gem "uploadcare-ruby", github: "uploadcare/uploadcare-ruby", branch: "5-0-stable"
69+
gem "uploadcare-rails", "5.0.0.rc1"
70+
gem "uploadcare-ruby", "5.0.0.rc1"
7071

7172
# Use MongoDB for the database, with Mongoid as the ODM
7273
gem "mongoid", "< 10"

Gemfile.lock

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,3 @@
1-
GIT
2-
remote: https://github.com/uploadcare/uploadcare-rails.git
3-
revision: 01c73621db5d138f597e5400308f8646209c0aea
4-
branch: 5-0-stable
5-
specs:
6-
uploadcare-rails (5.0.0.rc1)
7-
rails (>= 7.2)
8-
uploadcare-ruby (>= 5.0.0.rc1)
9-
10-
GIT
11-
remote: https://github.com/uploadcare/uploadcare-ruby.git
12-
revision: 181cdb32a3c7535e6f94eaed4b9939297c1a9d81
13-
branch: 5-0-stable
14-
specs:
15-
uploadcare-ruby (5.0.0.rc1)
16-
addressable (~> 2.8)
17-
faraday (~> 2.14)
18-
faraday-multipart (~> 1.0)
19-
mime-types (~> 3.7)
20-
zeitwerk (~> 2.7)
21-
221
GEM
232
remote: https://rubygems.org/
243
specs:
@@ -207,7 +186,7 @@ GEM
207186
multipart-post (2.4.1)
208187
net-http (0.9.1)
209188
uri (>= 0.11.1)
210-
net-imap (0.6.3)
189+
net-imap (0.6.4)
211190
date
212191
net-protocol
213192
net-pop (0.1.2)
@@ -368,6 +347,13 @@ GEM
368347
sexp_processor (4.17.5)
369348
spring (4.4.2)
370349
stringio (3.2.0)
350+
tailwindcss-rails (4.4.0)
351+
railties (>= 7.0.0)
352+
tailwindcss-ruby (~> 4.0)
353+
tailwindcss-ruby (4.2.2-aarch64-linux-gnu)
354+
tailwindcss-ruby (4.2.2-arm64-darwin)
355+
tailwindcss-ruby (4.2.2-x86_64-darwin)
356+
tailwindcss-ruby (4.2.2-x86_64-linux-gnu)
371357
thor (1.5.0)
372358
timeout (0.6.1)
373359
tsort (0.2.0)
@@ -379,6 +365,15 @@ GEM
379365
unicode-display_width (3.2.0)
380366
unicode-emoji (~> 4.1)
381367
unicode-emoji (4.2.0)
368+
uploadcare-rails (5.0.0.rc1)
369+
rails (>= 7.2)
370+
uploadcare-ruby (>= 5.0.0.rc1)
371+
uploadcare-ruby (5.0.0.rc1)
372+
addressable (~> 2.8)
373+
faraday (~> 2.14)
374+
faraday-multipart (~> 1.0)
375+
mime-types (~> 3.7)
376+
zeitwerk (~> 2.7)
382377
uri (1.1.1)
383378
useragent (0.16.11)
384379
web-console (4.3.0)
@@ -425,10 +420,11 @@ DEPENDENCIES
425420
rspec-rails
426421
rubocop-rails-omakase
427422
spring
423+
tailwindcss-rails (~> 4.4)
428424
turbo-rails
429425
tzinfo-data
430-
uploadcare-rails!
431-
uploadcare-ruby!
426+
uploadcare-rails (= 5.0.0.rc1)
427+
uploadcare-ruby (= 5.0.0.rc1)
432428
web-console
433429

434430
RUBY VERSION

Procfile.dev

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
web: mise exec -- ruby bin/rails server
22
js: mise exec -- pnpm build --watch
3+
css: mise exec -- ruby bin/rails tailwindcss:watch

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Uploadcare Rails Example app
22

33
This example project demonstrates the uploadcare-rails capabilities.
4-
The app is pinned to the `5-0-stable` branches of `uploadcare/uploadcare-rails` and `uploadcare/uploadcare-ruby`, targets Ruby `>= 4.0.0`, runs Rails `8.1.x`, and uses pnpm-managed Hotwire assets.
4+
The app uses the `5.0.0.rc1` prerelease gems for `uploadcare-rails` and `uploadcare-ruby`, targets Ruby `>= 4.0.0`, runs Rails `8.1.x`, and uses Hotwire with Tailwind CSS.
55

66
* [Installation](#installation)
77
* [Requirements](#requirements)
@@ -51,6 +51,7 @@ $ cd uploadcare-rails-example
5151
$ mise exec -- bundle install
5252
$ mise exec -- pnpm install
5353
$ mise exec -- pnpm build
54+
$ mise exec -- ruby bin/rails tailwindcss:build
5455
$ mise exec -- ruby bin/rails db:prepare
5556
$ mise exec -- ruby bin/rails db:migrate
5657
```
@@ -68,7 +69,7 @@ Start the server and the pnpm watcher together:
6869
$ ./bin/dev
6970
```
7071

71-
`bin/dev` runs Rails plus `pnpm build --watch`, so Hotwire assets stay current while you work.
72+
`bin/dev` runs Rails plus `pnpm build --watch` and `tailwindcss:watch`, so Hotwire and Tailwind assets stay current while you work.
7273

7374
![Application is available](./references/application-up-in-browser.png)
7475

@@ -177,7 +178,7 @@ The example app uploads files in three ways: local file upload via the Upload AP
177178
---
178179
**NOTE**
179180

180-
The app now uses the current `5-0-stable` branch APIs. The Post and Comment forms render the v1 Uploadcare File Uploader Web Components directly with `<uc-form-input>`, `<uc-config>`, `<uc-file-uploader-regular>`, and `<uc-upload-ctx-provider>`. Group uploads submit a single Uploadcare group URL that matches `has_uploadcare_files`. Manual API actions in controllers use `Uploadcare::Rails.client`, and the conversion examples use the raw REST parity layer where exact path control is needed.
181+
The app now uses the current `5.0.0.rc1` prerelease APIs. The Post and Comment forms render the v1 Uploadcare File Uploader Web Components directly with `<uc-form-input>`, `<uc-config>`, `<uc-file-uploader-regular>`, and `<uc-upload-ctx-provider>`. Group uploads submit a single Uploadcare group URL that matches `has_uploadcare_files`. Manual API actions in controllers use `Uploadcare::Rails.client`, and the conversion examples use the raw REST parity layer where exact path control is needed.
181182

182183
---
183184

Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
@import "tailwindcss";
2+
3+
@layer base {
4+
body {
5+
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
6+
}
7+
8+
h1 {
9+
@apply mb-2 text-2xl font-semibold tracking-normal text-slate-950;
10+
}
11+
12+
h2 {
13+
@apply text-xl font-semibold tracking-normal text-slate-950;
14+
}
15+
16+
h3 {
17+
@apply text-lg font-semibold tracking-normal text-slate-950;
18+
}
19+
20+
h4 {
21+
@apply text-base font-semibold tracking-normal text-slate-950;
22+
}
23+
24+
a {
25+
@apply text-slate-900 underline-offset-4 hover:text-slate-700 hover:underline;
26+
}
27+
28+
code {
29+
@apply rounded bg-slate-100 px-1.5 py-0.5 text-sm text-slate-900;
30+
}
31+
}
32+
33+
@layer components {
34+
.page-lede {
35+
@apply mb-5 max-w-3xl text-sm leading-6 text-slate-600;
36+
}
37+
38+
.card {
39+
@apply overflow-hidden rounded-md border border-slate-200 bg-white shadow-sm;
40+
}
41+
42+
.card-body {
43+
@apply p-5;
44+
}
45+
46+
.card-title {
47+
@apply mb-3 font-semibold text-slate-950;
48+
}
49+
50+
.list-group {
51+
@apply divide-y divide-slate-200 rounded-md border border-slate-200 bg-white;
52+
}
53+
54+
.list-group-flush {
55+
@apply rounded-none border-x-0 border-b-0;
56+
}
57+
58+
.list-group-item {
59+
@apply p-4 text-sm text-slate-700;
60+
}
61+
62+
.btn {
63+
@apply inline-flex items-center justify-center rounded-md border border-transparent px-3 py-2 text-sm font-medium no-underline transition focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50;
64+
}
65+
66+
.btn-sm {
67+
@apply px-2.5 py-1.5 text-xs;
68+
}
69+
70+
.btn-primary {
71+
@apply bg-slate-950 text-white hover:bg-slate-800 hover:text-white;
72+
}
73+
74+
.btn-secondary {
75+
@apply border-slate-300 bg-white text-slate-800 hover:bg-slate-100 hover:text-slate-950;
76+
}
77+
78+
.btn-danger {
79+
@apply bg-rose-600 text-white hover:bg-rose-700 hover:text-white;
80+
}
81+
82+
.btn-outline-primary {
83+
@apply border-slate-950 bg-white text-slate-950 hover:bg-slate-950 hover:text-white;
84+
}
85+
86+
.btn-group {
87+
@apply flex flex-wrap items-center gap-2;
88+
}
89+
90+
.button_to {
91+
@apply inline-flex;
92+
}
93+
94+
.badge {
95+
@apply inline-flex items-center rounded-md px-2 py-1 text-xs font-medium no-underline;
96+
}
97+
98+
.badge-secondary {
99+
@apply bg-slate-100 text-slate-700;
100+
}
101+
102+
.badge-info {
103+
@apply bg-sky-100 text-sky-800;
104+
}
105+
106+
.form-control,
107+
.custom-file-input,
108+
input[type="text"],
109+
input[type="url"],
110+
input[type="email"],
111+
input[type="number"],
112+
input[type="file"],
113+
textarea,
114+
select {
115+
@apply mt-1 block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-sm text-slate-950 shadow-sm focus:border-slate-500 focus:outline-none focus:ring-2 focus:ring-slate-200;
116+
}
117+
118+
label,
119+
.form-check-label {
120+
@apply text-sm font-medium text-slate-700;
121+
}
122+
123+
.form-check {
124+
@apply flex items-center gap-2;
125+
}
126+
127+
.form-check-input,
128+
input[type="checkbox"],
129+
input[type="radio"] {
130+
@apply h-4 w-4 rounded border-slate-300 text-slate-950 focus:ring-slate-400;
131+
}
132+
133+
.custom-file-label {
134+
@apply mt-2 block text-xs text-slate-500;
135+
}
136+
137+
.table {
138+
@apply w-full divide-y divide-slate-200 text-left text-sm;
139+
}
140+
141+
.table th {
142+
@apply bg-slate-50 px-3 py-2 font-semibold text-slate-700;
143+
}
144+
145+
.table td {
146+
@apply px-3 py-2 text-slate-700;
147+
}
148+
149+
.row {
150+
@apply grid gap-4;
151+
}
152+
153+
.row-cols-1 {
154+
@apply grid-cols-1;
155+
}
156+
157+
.row-cols-lg-2 {
158+
@apply lg:grid-cols-2;
159+
}
160+
161+
.col {
162+
@apply min-w-0;
163+
}
164+
165+
.text-body-secondary {
166+
@apply text-slate-500;
167+
}
168+
169+
.text-place {
170+
@apply min-w-0;
171+
}
172+
173+
.text-truncate {
174+
@apply truncate;
175+
}
176+
177+
.d-flex {
178+
@apply flex;
179+
}
180+
181+
.d-inline {
182+
@apply inline-flex;
183+
}
184+
185+
.justify-content-between {
186+
@apply justify-between;
187+
}
188+
189+
.align-items-center {
190+
@apply items-center;
191+
}
192+
193+
.flex-grow-1 {
194+
@apply flex-1;
195+
}
196+
197+
.flex-shrink-0 {
198+
@apply flex-shrink-0;
199+
}
200+
201+
.h-100 {
202+
@apply h-full;
203+
}
204+
205+
.w-100 {
206+
@apply w-full;
207+
}
208+
209+
.small {
210+
@apply text-sm;
211+
}
212+
213+
.h4 {
214+
@apply text-base font-semibold;
215+
}
216+
217+
.h5 {
218+
@apply text-sm font-semibold;
219+
}
220+
221+
.h1 {
222+
@apply text-2xl font-semibold;
223+
}
224+
225+
.d-block {
226+
@apply block;
227+
}
228+
229+
.table-responsive {
230+
@apply w-full overflow-x-auto;
231+
}
232+
233+
.g-3 {
234+
@apply gap-3;
235+
}
236+
}

0 commit comments

Comments
 (0)