File size: 15,061 Bytes
b190b45 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 |
# Cursor-Inspired UI Integration Guide
## π¨ Overview
This guide explains how to integrate the new Cursor-inspired flat+modern design system into your crypto trading platform pages.
---
## π¦ New CSS Files Created
### Core Design System
1. **`/static/shared/css/design-system-cursor.css`** (Required - Load First)
- Design tokens (colors, typography, spacing, shadows)
- Base reset and typography
- CSS variables for the entire system
- Inter font family loading
2. **`/static/shared/css/layout-cursor.css`** (Required)
- App container structure
- Sidebar navigation (240px, collapsible to 60px)
- Header (56px sleek design)
- Main content area
- Mobile responsive breakpoints
3. **`/static/shared/css/components-cursor.css`** (Required)
- Buttons (primary, secondary, ghost, danger, success)
- Cards (with hover lift effect)
- Forms (inputs, selects, textareas)
- Tables (clean, minimal borders)
- Badges, pills, alerts
- Modals, tooltips, dropdowns
- Skeleton loaders, progress bars
4. **`/static/shared/css/animations-cursor.css`** (Optional but Recommended)
- Keyframe animations (fade, slide, scale)
- Hover effects (lift, scale, glow)
- Loading states (spinners, dots)
- Page transitions
- Scroll reveal animations
- Utility animation classes
---
## π Quick Start - Update Your Pages
### Step 1: Update HTML `<head>` Section
Replace your existing CSS imports with the new Cursor design system:
```html
<!DOCTYPE html>
<html lang="en" data-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your Page Title - Crypto Monitor</title>
<!-- β
NEW: Cursor-Inspired Design System (Load in Order) -->
<link rel="stylesheet" href="/static/shared/css/design-system-cursor.css">
<link rel="stylesheet" href="/static/shared/css/layout-cursor.css">
<link rel="stylesheet" href="/static/shared/css/components-cursor.css">
<link rel="stylesheet" href="/static/shared/css/animations-cursor.css">
<!-- Optional: Page-specific CSS -->
<link rel="stylesheet" href="./your-page.css">
</head>
<body>
<!-- Your content here -->
</body>
</html>
```
### Step 2: Update HTML Structure
Use the new layout structure:
```html
<body>
<!-- App Container -->
<div class="app-container">
<!-- Sidebar (Injected or Imported) -->
<div id="sidebar-container"></div>
<!-- Main Content -->
<main class="main-content">
<!-- Header (Injected or Imported) -->
<div id="header-container"></div>
<!-- Page Content -->
<div class="page-content">
<div class="page-header">
<h1 class="page-title">Your Page Title</h1>
<p class="page-description">Optional description text</p>
</div>
<!-- Your page content goes here -->
</div>
</main>
</div>
</body>
```
### Step 3: Load Header and Sidebar
If using the LayoutManager (recommended):
```javascript
import { LayoutManager } from '/static/shared/js/core/layout-manager.js';
// Initialize layout with header and sidebar
await LayoutManager.init('yourPageName');
```
Or manually inject:
```javascript
// Load sidebar
const sidebarResponse = await fetch('/static/shared/layouts/sidebar.html');
const sidebarHtml = await sidebarResponse.text();
document.getElementById('sidebar-container').innerHTML = sidebarHtml;
// Load header
const headerResponse = await fetch('/static/shared/layouts/header.html');
const headerHtml = await headerResponse.text();
document.getElementById('header-container').innerHTML = headerHtml;
```
---
## π¨ Design System Reference
### Color Palette
**Backgrounds:**
- `--bg-primary: #0A0A0A` - Deep dark background
- `--bg-secondary: #121212` - Secondary background
- `--bg-tertiary: #1A1A1A` - Tertiary background
**Surfaces (Cards, Panels):**
- `--surface-primary: #1E1E1E` - Primary surface
- `--surface-secondary: #252525` - Secondary surface
- `--surface-tertiary: #2A2A2A` - Tertiary surface
**Text:**
- `--text-primary: #EFEFEF` - Primary text (high contrast)
- `--text-secondary: #A0A0A0` - Secondary text
- `--text-tertiary: #666666` - Tertiary text (muted)
**Accent Colors:**
- `--accent-purple: #8B5CF6` - Primary accent (Cursor-style)
- `--accent-purple-gradient: linear-gradient(135deg, #8B5CF6, #6D28D9)`
- `--accent-blue: #3B82F6` - Secondary accent
- `--color-success: #10B981` - Success green
- `--color-warning: #F59E0B` - Warning amber
- `--color-danger: #EF4444` - Danger red
- `--color-info: #06B6D4` - Info cyan
### Typography
**Font Stack:**
- Primary: `'Inter', -apple-system, system-ui, sans-serif`
- Monospace: `'JetBrains Mono', 'Fira Code', Consolas`
**Font Sizes:**
```css
--text-xs: 11px /* Labels, captions */
--text-sm: 13px /* Small text */
--text-base: 15px /* Body text (default) */
--text-lg: 17px /* Emphasized */
--text-xl: 20px /* H3 */
--text-2xl: 24px /* H2 */
--text-3xl: 30px /* H1 */
--text-4xl: 36px /* Hero */
```
**Font Weights:**
```css
--weight-normal: 400
--weight-medium: 500
--weight-semibold: 600
--weight-bold: 700
```
### Spacing
4px base grid system:
```css
--space-1: 4px
--space-2: 8px
--space-3: 12px
--space-4: 16px
--space-5: 20px
--space-6: 24px /* Standard card padding */
--space-8: 32px
--space-12: 48px
--space-16: 64px /* Section spacing */
```
### Border Radius
```css
--radius-sm: 6px /* Subtle */
--radius-md: 8px /* Standard buttons, inputs */
--radius-lg: 12px /* Cards */
--radius-xl: 16px /* Large cards */
--radius-full: 9999px /* Perfect circles */
```
### Shadows
```css
--shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12) /* Subtle */
--shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1) /* Default */
--shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15) /* Elevated */
--shadow-purple: 0 4px 12px rgba(139, 92, 246, 0.3) /* Purple glow */
```
### Animations
```css
--duration-fast: 150ms /* Quick interactions */
--duration-normal: 200ms /* Default (Cursor-style) */
--duration-medium: 300ms /* Slower transitions */
--ease-in-out: cubic-bezier(0.4, 0, 0.2, 1) /* Material Design */
```
---
## π Component Examples
### Buttons
```html
<!-- Primary Button (Purple Gradient) -->
<button class="btn btn-primary">
Primary Action
</button>
<!-- Secondary Button (Flat) -->
<button class="btn btn-secondary">
Secondary Action
</button>
<!-- Ghost Button (Transparent) -->
<button class="btn btn-ghost">
Cancel
</button>
<!-- Icon Button -->
<button class="btn btn-icon">
<svg>...</svg>
</button>
<!-- Button with Icon and Text -->
<button class="btn btn-primary">
<svg width="16" height="16">...</svg>
<span>Add Item</span>
</button>
```
### Cards
```html
<!-- Basic Card -->
<div class="card">
<h3>Card Title</h3>
<p>Card content goes here.</p>
</div>
<!-- Card with Header and Footer -->
<div class="card">
<div class="card-header">
<h3 class="card-title">Title</h3>
<button class="btn btn-ghost btn-sm">Action</button>
</div>
<div class="card-body">
<p>Content here...</p>
</div>
<div class="card-footer">
<button class="btn btn-secondary">Cancel</button>
<button class="btn btn-primary">Save</button>
</div>
</div>
<!-- Stat Card -->
<div class="stat-card">
<div class="stat-icon">
<svg>...</svg>
</div>
<div class="stat-value">$12,345</div>
<div class="stat-label">Total Volume</div>
<div class="stat-change positive">
β +12.5%
</div>
</div>
```
### Form Inputs
```html
<!-- Text Input -->
<div class="input-group">
<label class="input-label">Email Address</label>
<input type="email" class="input" placeholder="you@example.com" />
<span class="input-hint">We'll never share your email.</span>
</div>
<!-- Input with Error -->
<div class="input-group">
<label class="input-label">Password</label>
<input type="password" class="input error" placeholder="β’β’β’β’β’β’β’β’" />
<span class="input-error">Password must be at least 8 characters.</span>
</div>
<!-- Select -->
<select class="select">
<option>Choose an option</option>
<option>Option 1</option>
<option>Option 2</option>
</select>
<!-- Textarea -->
<textarea class="textarea" placeholder="Enter your message..."></textarea>
```
### Tables
```html
<div class="table-container">
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Price</th>
<th class="text-right">24h Change</th>
</tr>
</thead>
<tbody>
<tr>
<td>Bitcoin</td>
<td>$45,123</td>
<td class="text-right text-success">+5.2%</td>
</tr>
<tr>
<td>Ethereum</td>
<td>$2,345</td>
<td class="text-right text-danger">-2.1%</td>
</tr>
</tbody>
</table>
</div>
```
### Badges
```html
<span class="badge badge-primary">New</span>
<span class="badge badge-success">Active</span>
<span class="badge badge-warning">Pending</span>
<span class="badge badge-danger">Error</span>
<span class="badge badge-info">Info</span>
<!-- Pills (Rounded) -->
<span class="badge badge-primary pill">Live</span>
```
### Alerts
```html
<div class="alert alert-info">
<svg class="alert-icon" width="20" height="20">...</svg>
<div class="alert-content">
<div class="alert-title">Information</div>
<div class="alert-message">This is an informational message.</div>
</div>
</div>
```
### Modal
```html
<div class="modal-backdrop">
<div class="modal">
<div class="modal-header">
<h3 class="modal-title">Modal Title</h3>
<button class="modal-close">Γ</button>
</div>
<div class="modal-body">
<p>Modal content goes here...</p>
</div>
<div class="modal-footer">
<button class="btn btn-secondary">Cancel</button>
<button class="btn btn-primary">Confirm</button>
</div>
</div>
</div>
```
---
## π Animation Classes
### Entrance Animations
```html
<!-- Fade In -->
<div class="animate-fade-in">Content fades in</div>
<!-- Fade In Up -->
<div class="animate-fade-in-up">Content slides up and fades in</div>
<!-- Scale In -->
<div class="animate-scale-in">Content scales in</div>
<!-- Stagger Children -->
<div class="stagger-fade-in">
<div>Item 1 (delay: 0ms)</div>
<div>Item 2 (delay: 50ms)</div>
<div>Item 3 (delay: 100ms)</div>
</div>
```
### Hover Effects
```html
<!-- Lift on Hover -->
<div class="card hover-lift">Lifts up 2px on hover</div>
<!-- Scale on Hover -->
<div class="card hover-scale">Scales to 102% on hover</div>
<!-- Glow on Hover -->
<div class="card hover-glow">Glows with purple shadow on hover</div>
```
### Loading States
```html
<!-- Spinner -->
<div class="spinner"></div>
<!-- Dots Loader -->
<div class="dots-loader">
<span></span>
<span></span>
<span></span>
</div>
<!-- Skeleton Loader -->
<div class="skeleton skeleton-text" style="width: 200px;"></div>
<div class="skeleton skeleton-title" style="width: 300px;"></div>
```
---
## π± Mobile Responsive
The design system is mobile-first and responsive:
### Breakpoints
- **Mobile**: < 768px
- **Tablet**: 768px - 1024px
- **Desktop**: > 1024px
### Automatic Responsive Behavior
- **Sidebar**: Slides in as overlay on mobile (<1024px)
- **Header Search**: Hidden on mobile (<1024px)
- **Cards**: Full-width with reduced padding on mobile
- **Tables**: Horizontal scroll on mobile
### Mobile-Specific Classes
```html
<!-- Show mobile menu button on tablets/mobile -->
<button class="mobile-menu-btn" id="mobile-menu-toggle">β°</button>
<!-- Responsive grid -->
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--space-4);">
<div class="card">Card 1</div>
<div class="card">Card 2</div>
<div class="card">Card 3</div>
</div>
```
---
## β
Migration Checklist
When updating an existing page:
- [ ] Replace CSS imports with new Cursor design system files
- [ ] Update `<html>` tag: Add `data-theme="dark"` attribute
- [ ] Wrap content in `.app-container` β `.main-content` β `.page-content`
- [ ] Replace old button classes with `.btn .btn-primary` etc.
- [ ] Replace old card classes with `.card`
- [ ] Update form inputs to use `.input`, `.select`, `.textarea`
- [ ] Replace old table wrappers with `.table-container .table`
- [ ] Add animation classes where appropriate
- [ ] Test mobile responsiveness (< 768px)
- [ ] Verify sidebar collapse/expand works
- [ ] Check theme toggle functionality
---
## π― Best Practices
1. **Always load CSS in order:**
```
design-system-cursor.css β layout-cursor.css β components-cursor.css β animations-cursor.css
```
2. **Use CSS variables for consistency:**
```css
/* Good */
padding: var(--space-4);
color: var(--text-secondary);
/* Avoid */
padding: 16px;
color: #A0A0A0;
```
3. **Use animation classes instead of custom CSS:**
```html
<!-- Good -->
<div class="card hover-lift animate-fade-in">
<!-- Avoid -->
<div class="card" style="transition: all 0.3s; animation: fadeIn 0.5s;">
```
4. **Follow the 200ms animation standard:**
- All transitions should use `--duration-normal: 200ms`
- This matches Cursor's snappy feel
5. **Maintain dark theme by default:**
- Use `data-theme="dark"` on `<html>`
- Support light theme with theme toggle
---
## π§ Customization
To customize the design system, override CSS variables in your page-specific CSS:
```css
/* your-page.css */
:root {
/* Change primary accent from purple to blue */
--accent-purple: #3B82F6;
--accent-purple-gradient: linear-gradient(135deg, #3B82F6, #1E40AF);
/* Adjust spacing */
--space-6: 32px; /* Increase card padding */
/* Custom durations */
--duration-normal: 250ms; /* Slightly slower */
}
```
---
## π Support
For issues or questions:
1. Check the design system CSS files for available classes
2. Review this integration guide
3. Test in both desktop and mobile viewports
4. Verify all CSS files are loaded in correct order
---
## π Quick Links
- [Design System CSS](./shared/css/design-system-cursor.css)
- [Layout CSS](./shared/css/layout-cursor.css)
- [Components CSS](./shared/css/components-cursor.css)
- [Animations CSS](./shared/css/animations-cursor.css)
- [Header Layout](./shared/layouts/header.html)
- [Sidebar Layout](./shared/layouts/sidebar.html)
---
**Last Updated:** 2025-12-10
**Version:** 1.0.0
**Design System:** Cursor-Inspired Flat + Modern
|