Skip to content

Commit 9711cc4

Browse files
Normalize demo page styling (#461)
1 parent efb411e commit 9711cc4

58 files changed

Lines changed: 1580 additions & 1480 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/quiet-demo-surfaces.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@tanstack/create": patch
3+
"@tanstack/cli": patch
4+
---
5+
6+
Normalize generated demo pages to use the base template styling instead of bespoke full-page gradients and mismatched color treatments.

packages/create/src/frameworks/react/add-ons/ai/assets/src/components/demo-AIAssistant.tsx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function Messages({ messages }: { messages: ChatMessages }) {
2424

2525
if (!messages.length) {
2626
return (
27-
<div className="flex-1 flex items-center justify-center text-gray-400 text-sm">
27+
<div className="demo-muted flex flex-1 items-center justify-center text-sm">
2828
Ask me anything! I'm here to help.
2929
</div>
3030
)
@@ -36,25 +36,23 @@ function Messages({ messages }: { messages: ChatMessages }) {
3636
<div
3737
key={id}
3838
className={`py-3 ${
39-
role === 'assistant'
40-
? 'bg-linear-to-r from-orange-500/5 to-red-600/5'
41-
: 'bg-transparent'
39+
role === 'assistant' ? 'bg-[var(--chip-bg)]' : 'bg-transparent'
4240
}`}
4341
>
4442
{parts.map((part, index) => {
4543
if (part.type === 'text' && part.content) {
4644
return (
4745
<div key={index} className="flex items-start gap-2 px-4">
4846
{role === 'assistant' ? (
49-
<div className="w-6 h-6 rounded-lg bg-linear-to-r from-orange-500 to-red-600 flex items-center justify-center text-xs font-medium text-white flex-shrink-0">
47+
<div className="flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-lg bg-[var(--lagoon-deep)] text-xs font-medium text-white">
5048
AI
5149
</div>
5250
) : (
53-
<div className="w-6 h-6 rounded-lg bg-gray-700 flex items-center justify-center text-xs font-medium text-white flex-shrink-0">
51+
<div className="flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-lg bg-[var(--sea-ink-soft)] text-xs font-medium text-white">
5452
Y
5553
</div>
5654
)}
57-
<div className="flex-1 min-w-0 text-white prose dark:prose-invert max-w-none prose-sm">
55+
<div className="min-w-0 flex-1 max-w-none text-sm text-[var(--sea-ink)]">
5856
<Streamdown>{part.content}</Streamdown>
5957
</div>
6058
</div>
@@ -87,7 +85,7 @@ export default function AIAssistant() {
8785
<div className="relative z-50">
8886
<button
8987
onClick={() => showAIAssistant.setState((state) => !state)}
90-
className="w-full flex items-center justify-between px-4 py-2.5 rounded-lg bg-linear-to-r from-green-700 to-green-900 text-white hover:opacity-90 transition-opacity"
88+
className="demo-button w-full justify-between px-4 py-2.5"
9189
>
9290
<div className="flex items-center gap-2">
9391
<BotIcon size={24} />
@@ -97,20 +95,22 @@ export default function AIAssistant() {
9795
</button>
9896

9997
{isOpen && (
100-
<div className="absolute bottom-0 left-full ml-2 w-[700px] h-[600px] bg-gray-900 rounded-lg shadow-xl border border-orange-500/20 flex flex-col">
101-
<div className="flex items-center justify-between p-3 border-b border-orange-500/20">
102-
<h3 className="font-semibold text-white">AI Assistant</h3>
98+
<div className="demo-panel absolute bottom-0 left-full ml-2 flex h-[600px] w-[700px] flex-col overflow-hidden p-0">
99+
<div className="flex items-center justify-between border-b border-[var(--line)] p-3">
100+
<h3 className="font-semibold text-[var(--sea-ink)]">
101+
AI Assistant
102+
</h3>
103103
<button
104104
onClick={() => showAIAssistant.setState((state) => !state)}
105-
className="text-gray-400 hover:text-white transition-colors"
105+
className="demo-muted transition-colors hover:text-[var(--sea-ink)]"
106106
>
107107
<X className="w-4 h-4" />
108108
</button>
109109
</div>
110110

111111
<Messages messages={messages} />
112112

113-
<div className="p-3 border-t border-orange-500/20">
113+
<div className="border-t border-[var(--line)] p-3">
114114
<form
115115
onSubmit={(e) => {
116116
e.preventDefault()
@@ -125,7 +125,7 @@ export default function AIAssistant() {
125125
value={input}
126126
onChange={(e) => setInput(e.target.value)}
127127
placeholder="Type your message..."
128-
className="w-full rounded-lg border border-orange-500/20 bg-gray-800/50 pl-3 pr-10 py-2 text-sm text-white placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-orange-500/50 focus:border-transparent resize-none overflow-hidden"
128+
className="demo-textarea pr-10 text-sm"
129129
rows={1}
130130
style={{ minHeight: '36px', maxHeight: '120px' }}
131131
onInput={(e) => {
@@ -145,7 +145,7 @@ export default function AIAssistant() {
145145
<button
146146
type="submit"
147147
disabled={!input.trim()}
148-
className="absolute right-2 top-1/2 -translate-y-1/2 p-1.5 text-orange-500 hover:text-orange-400 disabled:text-gray-500 transition-colors focus:outline-none"
148+
className="absolute right-2 top-1/2 -translate-y-1/2 p-1.5 text-[var(--lagoon-deep)] transition-colors hover:text-[var(--sea-ink)] disabled:text-[var(--sea-ink-soft)]"
149149
>
150150
<Send className="w-4 h-4" />
151151
</button>

packages/create/src/frameworks/react/add-ons/ai/assets/src/components/demo-GuitarRecommendation.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default function GuitarRecommendation({ id }: { id: string }) {
1111
return null
1212
}
1313
return (
14-
<div className="my-4 rounded-lg overflow-hidden border border-orange-500/20 bg-gray-800/50">
14+
<div className="demo-card my-4 overflow-hidden p-0">
1515
<div className="aspect-[4/3] relative overflow-hidden">
1616
<img
1717
src={guitar.image}
@@ -20,23 +20,25 @@ export default function GuitarRecommendation({ id }: { id: string }) {
2020
/>
2121
</div>
2222
<div className="p-4">
23-
<h3 className="text-lg font-semibold text-white mb-2">{guitar.name}</h3>
24-
<p className="text-sm text-gray-300 mb-3 line-clamp-2">
23+
<h3 className="mb-2 text-lg font-semibold text-[var(--sea-ink)]">
24+
{guitar.name}
25+
</h3>
26+
<p className="demo-muted mb-3 line-clamp-2 text-sm">
2527
{guitar.shortDescription}
2628
</p>
2729
<div className="flex items-center justify-between">
28-
<div className="text-lg font-bold text-emerald-400">
30+
<div className="text-lg font-bold text-[var(--lagoon-deep)]">
2931
${guitar.price}
3032
</div>
3133
<button
3234
onClick={() => {
3335
navigate({
34-
to: '/example/guitars/$guitarId',
36+
to: '/demo/guitars/$guitarId',
3537
params: { guitarId: guitar.id.toString() },
3638
})
3739
showAIAssistant.setState(() => false)
3840
}}
39-
className="bg-gradient-to-r from-orange-500 to-red-600 text-white px-4 py-1.5 rounded-lg text-sm hover:opacity-90 transition-opacity"
41+
className="demo-button px-4 py-1.5 text-sm"
4042
>
4143
View Details
4244
</button>

packages/create/src/frameworks/react/add-ons/ai/assets/src/routes/demo/ai-chat.css

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@import 'tailwindcss';
2-
@import 'highlight.js/styles/github-dark.css';
2+
@import 'highlight.js/styles/github.css';
33
@source "../../../../node_modules/streamdown/dist/*.js";
44

55
/* Custom scrollbar styles */
@@ -28,7 +28,7 @@ html {
2828
/* Markdown content styles */
2929
.prose {
3030
max-width: none;
31-
color: #e5e7eb; /* text-gray-200 */
31+
color: var(--sea-ink-soft);
3232
}
3333

3434
/* .prose p {
@@ -37,15 +37,15 @@ html {
3737
} */
3838

3939
.prose code {
40-
color: #e5e7eb;
41-
background-color: rgba(31, 41, 55, 0.5);
40+
color: var(--sea-ink);
41+
background-color: var(--chip-bg);
4242
padding: 0.2em 0.4em;
4343
border-radius: 0.375rem;
4444
font-size: 0.875em;
4545
}
4646

4747
.prose pre {
48-
background-color: rgba(31, 41, 55, 0.5);
48+
background-color: var(--chip-bg);
4949
border-radius: 0.5rem;
5050
padding: 1rem;
5151
margin: 1.25em 0;
@@ -63,7 +63,7 @@ html {
6363
.prose h2,
6464
.prose h3,
6565
.prose h4 {
66-
color: #f9fafb; /* text-gray-50 */
66+
color: var(--sea-ink);
6767
/* margin-top: 2em; */
6868
/* margin-bottom: 1em; */
6969
}
@@ -81,27 +81,27 @@ html {
8181
}
8282

8383
.prose blockquote {
84-
border-left-color: #f97316; /* orange-500 */
85-
background-color: rgba(249, 115, 22, 0.1);
84+
border-left-color: var(--lagoon-deep);
85+
background-color: var(--chip-bg);
8686
padding: 1em;
8787
margin: 1.25em 0;
8888
border-radius: 0.5rem;
8989
}
9090

9191
.prose hr {
92-
border-color: rgba(249, 115, 22, 0.2);
92+
border-color: var(--line);
9393
margin: 2em 0;
9494
}
9595

9696
.prose a {
97-
color: #f97316; /* orange-500 */
97+
color: var(--lagoon-deep);
9898
text-decoration: underline;
9999
text-decoration-thickness: 0.1em;
100100
text-underline-offset: 0.2em;
101101
}
102102

103103
.prose a:hover {
104-
color: #fb923c; /* orange-400 */
104+
color: var(--sea-ink);
105105
}
106106

107107
.prose table {
@@ -113,11 +113,11 @@ html {
113113
.prose th,
114114
.prose td {
115115
padding: 0.75em;
116-
border: 1px solid rgba(249, 115, 22, 0.2);
116+
border: 1px solid var(--line);
117117
}
118118

119119
.prose th {
120-
background-color: rgba(249, 115, 22, 0.1);
120+
background-color: var(--chip-bg);
121121
font-weight: 600;
122122
}
123123

@@ -181,16 +181,16 @@ html {
181181

182182
.prose th,
183183
.prose td {
184-
border: 1px solid rgba(249, 115, 22, 0.2);
184+
border: 1px solid var(--line);
185185
padding: 0.5em;
186186
}
187187

188188
.prose th {
189-
background-color: rgba(249, 115, 22, 0.1);
189+
background-color: var(--chip-bg);
190190
}
191191

192192
.prose strong {
193-
color: #f9fafb; /* text-gray-50 */
193+
color: var(--sea-ink);
194194
font-weight: 600;
195195
}
196196

@@ -199,23 +199,23 @@ html {
199199
}
200200

201201
.prose blockquote {
202-
border-left: 4px solid #f97316; /* orange-500 */
202+
border-left: 4px solid var(--lagoon-deep);
203203
padding-left: 1em;
204204
margin: 1em 0;
205-
color: #d1d5db; /* text-gray-300 */
205+
color: var(--sea-ink-soft);
206206
}
207207

208208
/* Ensure code blocks match the AI's formatting */
209209
.prose code {
210-
color: #e5e7eb;
211-
background-color: rgba(31, 41, 55, 0.5);
210+
color: var(--sea-ink);
211+
background-color: var(--chip-bg);
212212
padding: 0.2em 0.4em;
213213
border-radius: 0.375rem;
214214
font-size: 0.875em;
215215
}
216216

217217
.prose pre {
218-
background-color: rgba(31, 41, 55, 0.5);
218+
background-color: var(--chip-bg);
219219
border-radius: 0.5rem;
220220
padding: 1rem;
221221
margin: 1em 0;

packages/create/src/frameworks/react/add-ons/ai/assets/src/routes/demo/ai-chat.tsx

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ function InitialLayout({ children }: { children: React.ReactNode }) {
2424
return (
2525
<div className="flex-1 flex items-center justify-center px-4">
2626
<div className="text-center max-w-3xl mx-auto w-full">
27-
<h1 className="text-6xl font-bold mb-4 bg-linear-to-r from-orange-500 to-red-600 text-transparent bg-clip-text uppercase">
28-
<span className="text-white">TanStack</span> Chat
29-
</h1>
30-
<p className="text-gray-400 mb-6 w-2/3 mx-auto text-lg">
27+
<h1 className="demo-title mb-4">TanStack Chat</h1>
28+
<p className="demo-muted mb-6 mx-auto max-w-2xl text-lg">
3129
You can ask me about anything, I might or might not have a good
3230
answer, but you can still ask.
3331
</p>
@@ -39,7 +37,7 @@ function InitialLayout({ children }: { children: React.ReactNode }) {
3937

4038
function ChattingLayout({ children }: { children: React.ReactNode }) {
4139
return (
42-
<div className="sticky bottom-0 left-0 right-0 bg-gray-900/80 backdrop-blur-sm border-t border-orange-500/10 z-10">
40+
<div className="sticky bottom-0 left-0 right-0 z-10 border-t border-[var(--line)] bg-[var(--header-bg)] backdrop-blur-sm">
4341
<div className="max-w-3xl mx-auto w-full px-4 py-3">{children}</div>
4442
</div>
4543
)
@@ -96,17 +94,17 @@ function Messages({
9694
key={message.id}
9795
className={`p-4 ${
9896
message.role === 'assistant'
99-
? 'bg-linear-to-r from-orange-500/5 to-red-600/5'
97+
? 'bg-[var(--chip-bg)]'
10098
: 'bg-transparent'
10199
}`}
102100
>
103101
<div className="flex items-start gap-4 max-w-3xl mx-auto w-full">
104102
{message.role === 'assistant' ? (
105-
<div className="w-8 h-8 rounded-lg bg-linear-to-r from-orange-500 to-red-600 mt-2 flex items-center justify-center text-sm font-medium text-white flex-shrink-0">
103+
<div className="mt-2 flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg bg-[var(--lagoon-deep)] text-sm font-medium text-white">
106104
AI
107105
</div>
108106
) : (
109-
<div className="w-8 h-8 rounded-lg bg-gray-700 flex items-center justify-center text-sm font-medium text-white flex-shrink-0">
107+
<div className="flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg bg-[var(--sea-ink-soft)] text-sm font-medium text-white">
110108
Y
111109
</div>
112110
)}
@@ -115,7 +113,7 @@ function Messages({
115113
if (part.type === 'text' && part.content) {
116114
return (
117115
<div
118-
className="flex-1 min-w-0 prose dark:prose-invert max-w-none prose-sm"
116+
className="prose prose-sm min-w-0 max-w-none flex-1"
119117
key={index}
120118
>
121119
<Streamdown>{part.content}</Streamdown>
@@ -145,7 +143,7 @@ function Messages({
145143
? onStopSpeak()
146144
: onSpeak(textContent, message.id)
147145
}
148-
className="flex-shrink-0 p-2 text-gray-400 hover:text-orange-400 transition-colors"
146+
className="demo-muted flex-shrink-0 p-2 transition-colors hover:text-[var(--lagoon-deep)]"
149147
title={isPlaying ? 'Stop speaking' : 'Read aloud'}
150148
>
151149
{isPlaying ? (
@@ -190,7 +188,7 @@ function ChatPage() {
190188
const Layout = messages.length ? ChattingLayout : InitialLayout
191189

192190
return (
193-
<div className="relative flex h-[calc(100vh-80px)] bg-gray-900">
191+
<div className="relative flex h-[calc(100vh-12rem)] min-h-[32rem]">
194192
<div className="flex-1 flex flex-col min-h-0">
195193
<Messages
196194
messages={messages}
@@ -205,7 +203,7 @@ function ChatPage() {
205203
<div className="flex items-center justify-center">
206204
<button
207205
onClick={stop}
208-
className="px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg text-sm font-medium transition-colors flex items-center gap-2"
206+
className="demo-button demo-button-danger"
209207
>
210208
<Square className="w-4 h-4 fill-current" />
211209
Stop
@@ -226,10 +224,8 @@ function ChatPage() {
226224
type="button"
227225
onClick={handleMicClick}
228226
disabled={isLoading || isTranscribing}
229-
className={`p-3 rounded-lg transition-colors ${
230-
isRecording
231-
? 'bg-red-600 hover:bg-red-700 text-white'
232-
: 'bg-gray-800/50 text-gray-400 hover:text-orange-400 border border-orange-500/20'
227+
className={`demo-button p-3 ${
228+
isRecording ? 'demo-button-danger' : 'demo-button-secondary'
233229
} disabled:opacity-50`}
234230
title={isRecording ? 'Stop recording' : 'Start recording'}
235231
>
@@ -247,7 +243,7 @@ function ChatPage() {
247243
value={input}
248244
onChange={(e) => setInput(e.target.value)}
249245
placeholder="Type something clever..."
250-
className="w-full rounded-lg border border-orange-500/20 bg-gray-800/50 pl-4 pr-12 py-3 text-sm text-white placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-orange-500/50 focus:border-transparent resize-none overflow-hidden shadow-lg"
246+
className="demo-textarea pr-12 text-sm"
251247
rows={1}
252248
style={{ minHeight: '44px', maxHeight: '200px' }}
253249
disabled={isLoading}
@@ -268,7 +264,7 @@ function ChatPage() {
268264
<button
269265
type="submit"
270266
disabled={!input.trim() || isLoading}
271-
className="absolute right-2 top-1/2 -translate-y-1/2 p-2 text-orange-500 hover:text-orange-400 disabled:text-gray-500 transition-colors focus:outline-none"
267+
className="absolute right-2 top-1/2 -translate-y-1/2 p-2 text-[var(--lagoon-deep)] transition-colors hover:text-[var(--sea-ink)] disabled:text-[var(--sea-ink-soft)]"
272268
>
273269
<Send className="w-4 h-4" />
274270
</button>

0 commit comments

Comments
 (0)