Skip to content

Commit 26f6a97

Browse files
Copilothuangyiirene
andcommitted
Refactor inline styles to CSS utility classes for better maintainability
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
1 parent 9ae7a02 commit 26f6a97

3 files changed

Lines changed: 22 additions & 16 deletions

File tree

apps/playground/src/index.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,21 @@
6767
@apply bg-background text-foreground;
6868
}
6969
}
70+
71+
@layer utilities {
72+
/* Dot grid background patterns */
73+
.bg-dot-pattern {
74+
background-image: radial-gradient(circle, #cbd5e1 1.5px, transparent 1.5px);
75+
background-size: 32px 32px;
76+
}
77+
78+
.bg-dot-pattern-sm {
79+
background-image: radial-gradient(circle, #cbd5e1 1px, transparent 1px);
80+
background-size: 20px 20px;
81+
}
82+
83+
/* Custom spinner animation */
84+
.animate-spin-reverse {
85+
animation: spin 1s linear infinite reverse;
86+
}
87+
}

apps/playground/src/pages/Home.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,7 @@ export const Home = () => {
111111
{/* Mock Preview Window */}
112112
<div className="bg-gradient-to-br from-gray-50 to-slate-100 border-b border-gray-200 p-6 flex-1 flex items-center justify-center overflow-hidden relative">
113113
{/* Decorative grid */}
114-
<div className="absolute inset-0 opacity-20" style={{
115-
backgroundImage: 'radial-gradient(circle, #cbd5e1 1px, transparent 1px)',
116-
backgroundSize: '20px 20px'
117-
}}></div>
114+
<div className="absolute inset-0 opacity-20 bg-dot-pattern-sm"></div>
118115

119116
<div className="relative w-3/4 h-3/4 bg-white shadow-xl border-2 border-gray-300 rounded-xl flex flex-col group-hover:scale-110 transition-transform duration-500">
120117
<div className="h-5 border-b-2 border-gray-200 bg-gradient-to-b from-gray-100 to-gray-50 flex items-center px-2 gap-1.5 rounded-t-xl">

apps/playground/src/pages/Studio.tsx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,7 @@ const StudioEditor = ({ exampleId, initialJson }: { exampleId: ExampleKey, initi
323323
</div>
324324

325325
<div
326-
className="flex-1 overflow-auto p-8 flex justify-center bg-gradient-to-br from-slate-100 via-gray-50 to-indigo-100 relative"
327-
style={{
328-
backgroundImage: 'radial-gradient(circle, #cbd5e1 1.5px, transparent 1.5px)',
329-
backgroundSize: '32px 32px'
330-
}}
326+
className="flex-1 overflow-auto p-8 flex justify-center bg-gradient-to-br from-slate-100 via-gray-50 to-indigo-100 relative bg-dot-pattern"
331327
>
332328
<div className={`${viewportStyles[viewportSize]} transition-all duration-300 ease-in-out`}>
333329
<div
@@ -369,7 +365,7 @@ const StudioEditor = ({ exampleId, initialJson }: { exampleId: ExampleKey, initi
369365
<div className="flex flex-col items-center gap-4">
370366
<div className="relative">
371367
<div className="w-12 h-12 border-4 border-indigo-200 border-t-indigo-600 rounded-full animate-spin"></div>
372-
<div className="absolute inset-0 w-12 h-12 border-4 border-purple-200 border-t-purple-600 rounded-full animate-spin" style={{ animationDirection: 'reverse', animationDuration: '1s' }}></div>
368+
<div className="absolute inset-0 w-12 h-12 border-4 border-purple-200 border-t-purple-600 rounded-full animate-spin-reverse"></div>
373369
</div>
374370
<p className="text-sm font-semibold text-gray-600">Rendering your UI...</p>
375371
</div>
@@ -414,12 +410,7 @@ const StudioEditor = ({ exampleId, initialJson }: { exampleId: ExampleKey, initi
414410
</div>
415411

416412
{/* Side Preview */}
417-
<div className="w-1/2 h-full flex flex-col bg-gradient-to-br from-slate-100 via-gray-50 to-indigo-100 relative"
418-
style={{
419-
backgroundImage: 'radial-gradient(circle, #cbd5e1 1.5px, transparent 1.5px)',
420-
backgroundSize: '32px 32px'
421-
}}
422-
>
413+
<div className="w-1/2 h-full flex flex-col bg-gradient-to-br from-slate-100 via-gray-50 to-indigo-100 relative bg-dot-pattern">
423414
<div className="flex-1 overflow-auto p-8 flex items-center justify-center">
424415
<div className="w-full max-w-xl mx-auto rounded-2xl shadow-2xl bg-background border-2 border-gray-300 overflow-hidden">
425416
<div className="h-9 bg-gradient-to-b from-gray-100 to-gray-50 border-b-2 border-gray-300 flex items-center px-3 gap-2">

0 commit comments

Comments
 (0)