Skip to content

Commit f1f58fe

Browse files
authored
feat: making no tailwind a legit option (#151)
* feat: making no tailwind a legit option * fix: making sure we respect the tailwind choice
1 parent 5641cb1 commit f1f58fe

34 files changed

+225
-33
lines changed

.changeset/purple-dingos-cough.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@tanstack/cta-framework-react-cra': minor
3+
'@tanstack/cta-engine': minor
4+
'@tanstack/cta-framework-solid': minor
5+
'@tanstack/cta-cli': minor
6+
'create-start-app': minor
7+
'create-tanstack': minor
8+
'create-tanstack-app': minor
9+
'create-tsrouter-app': minor
10+
'@tanstack/create-start': minor
11+
'@tanstack/cta-ui': minor
12+
'@tanstack/cta-ui-base': minor
13+
---
14+
15+
allowing for no tailwind

frameworks/react-cra/add-ons/start/assets/src/routes/demo/start.api-request.tsx.ejs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import { useQuery } from '@tanstack/react-query'
33
<% } else { %>
44
import { useEffect, useState } from 'react'
55
<% } %>
6-
import { createFileRoute } from '@tanstack/react-router'
6+
import { createFileRoute } from '@tanstack/react-router'<% if (!tailwind) { %>
7+
import './start.css'
8+
<% } %>
79

810
function getNames() {
911
return fetch('/demo/api/names').then((res) => res.json() as Promise<string[]>)
@@ -27,6 +29,7 @@ function Home() {
2729
}, [])
2830
<% } %>
2931
return (
32+
<% if (tailwind) { %>
3033
<div
3134
className="flex items-center justify-center min-h-screen p-4 text-white"
3235
style={{
@@ -49,5 +52,17 @@ function Home() {
4952
</ul>
5053
</div>
5154
</div>
55+
<% } else { %>
56+
<div className="api-page">
57+
<div className="content">
58+
<h1>Start API Request Demo - Names List</h1>
59+
<ul>
60+
{names.map((name) => (
61+
<li key={name}>{name}</li>
62+
))}
63+
</ul>
64+
</div>
65+
</div>
66+
<% } %>
5267
)
5368
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<% if (tailwind) { ignoreFile() } %>.api-page {
2+
display: flex;
3+
align-items: center;
4+
justify-content: center;
5+
min-height: 100vh;
6+
padding: 1rem;
7+
color: #fff;
8+
}
9+
10+
.api-page .content {
11+
width: 100%;
12+
max-width: 2xl;
13+
padding: 8rem;
14+
border-radius: 1rem;
15+
backdrop-filter: blur(1rem);
16+
background-color: rgba(0, 0, 0, 0.5);
17+
box-shadow: 0 0 1rem 0 rgba(0, 0, 0, 0.1);
18+
border: 0.5rem solid rgba(0, 0, 0, 0.1);
19+
}
20+
21+
.api-page .content h1 {
22+
font-size: 2rem;
23+
margin-bottom: 1rem;
24+
}
25+
26+
.api-page .content ul {
27+
margin-bottom: 1rem;
28+
list-style: none;
29+
padding: 0;
30+
}
31+
32+
.api-page .content li {
33+
background-color: rgba(255, 255, 255, 0.1);
34+
padding: 0.5rem;
35+
border-radius: 0.5rem;
36+
border: 1px solid rgba(255, 255, 255, 0.2);
37+
backdrop-filter: blur(0.5rem);
38+
box-shadow: 0 0 0.5rem 0 rgba(255, 255, 255, 0.1);
39+
}
40+
41+
.api-page .content li span {
42+
font-size: 1.2rem;
43+
}

frameworks/react-cra/add-ons/start/assets/src/routes/demo/start.server-funcs.tsx.ejs

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ function Home() {
4242
<% } else { %>import fs from 'node:fs'
4343
import { useCallback, useState } from 'react'
4444
import { createFileRoute, useRouter } from '@tanstack/react-router'
45-
import { createServerFn } from '@tanstack/react-start'
45+
import { createServerFn } from '@tanstack/react-start'<% if (!tailwind) { %>
46+
import './start.css'
47+
<% } %>
4648
4749
/*
4850
const loggingMiddleware = createMiddleware().server(
@@ -104,6 +106,7 @@ function Home() {
104106
}, [addTodo, todo])
105107
106108
return (
109+
<% if (tailwind) { %>
107110
<div
108111
className="flex items-center justify-center min-h-screen bg-gradient-to-br from-zinc-800 to-black p-4 text-white"
109112
style={{
@@ -146,6 +149,35 @@ function Home() {
146149
</div>
147150
</div>
148151
</div>
152+
<% } else { %>
153+
<div>
154+
<h1>Start Server Functions - Todo Example</h1>
155+
<ul>
156+
{todos?.map((t) => (
157+
<li key={t.id}>{t.name}</li>
158+
))}
159+
</ul>
160+
<div className="flex flex-col gap-2">
161+
<input
162+
type="text"
163+
value={todo}
164+
onChange={(e) => setTodo(e.target.value)}
165+
onKeyDown={(e) => {
166+
if (e.key === 'Enter') {
167+
submitTodo()
168+
}
169+
}}
170+
placeholder="Enter a new todo..."
171+
/>
172+
<button
173+
disabled={todo.trim().length === 0}
174+
onClick={submitTodo}
175+
>
176+
Add todo
177+
</button>
178+
</div>
179+
</div>
180+
<% } %>
149181
)
150182
}
151183
<% } %>

frameworks/react-cra/add-ons/start/assets/src/routes/demo/start.ssr.spa-mode.tsx.ejs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ function RouteComponent() {
4949
return (
5050
<div>
5151
<h1>SPA Mode - Punk Songs</h1>
52-
</div>
5352
<ul>
5453
{punkSongs.map((song) => (
5554
<li key={song.id}>

frameworks/react-cra/add-ons/start/assets/src/routes/index.tsx.ejs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { createFileRoute } from "@tanstack/react-router"; <% if (!tailwind) { %>
2-
import logo from "../logo.svg"
32
import "../App.css"
43
<% } else { %>
54
import {
@@ -115,7 +114,10 @@ return (
115114
); <% } else { %> return (
116115
<div className="App">
117116
<header className="App-header">
118-
<img src="{logo}" className="App-logo" alt="logo" />
117+
<img
118+
src="/tanstack-circle-logo.png"
119+
className="App-logo" alt="TanStack Logo"
120+
/>
119121
<p>Edit <code>src/routes/index.tsx</code> and save to reload.</p>
120122
<a
121123
className="App-link"

frameworks/react-cra/add-ons/start/assets/vite.config.ts.ejs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import { paraglideVitePlugin } from "@inlang/paraglide-js"
66
import { tanstackStart } from '@tanstack/react-start/plugin/vite';
77
import viteReact from '@vitejs/plugin-react'
88
import viteTsConfigPaths from 'vite-tsconfig-paths'
9-
import { fileURLToPath, URL } from 'url'<% if (tailwind) { %>
9+
import { fileURLToPath, URL } from 'url'
10+
<% if (tailwind) { %>
1011
import tailwindcss from "@tailwindcss/vite"
1112
<% } %><% for(const integration of integrations.filter(i => i.type === 'vite-plugin')) { %><%- integrationImportContent(integration) %>
1213
<% } %>

frameworks/react-cra/add-ons/start/info.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
"link": "https://tanstack.com/start/latest",
66
"modes": ["file-router"],
77
"type": "add-on",
8+
"tailwind": false,
89
"priority": 26,
10+
"warning": "TanStack Start is not yet at 1.0 and may change significantly or not be compatible with other add-ons.\nMigrating to Start might require deleting node_modules and re-installing.",
911
"routes": [
1012
{
1113
"icon": "SquareFunction",
@@ -52,6 +54,6 @@
5254
]
5355
}
5456
],
55-
"deletedFiles": ["./index.html", "./src/main.tsx", "./src/App.css"],
57+
"deletedFiles": ["./index.html", "./src/main.tsx"],
5658
"addOnSpecialSteps": ["rimraf-node-modules"]
5759
}

frameworks/react-cra/hosts/cloudflare/info.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"modes": ["file-router", "code-router"],
77
"type": "deployment",
88
"priority": 200,
9+
"tailwind": false,
910
"integrations": [
1011
{
1112
"type": "vite-plugin",

frameworks/react-cra/hosts/netlify/info.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"modes": ["file-router", "code-router"],
77
"type": "deployment",
88
"priority": 180,
9+
"tailwind": false,
910
"integrations": [
1011
{
1112
"type": "vite-plugin",

0 commit comments

Comments
 (0)