| <!DOCTYPE html> |
| <html lang="en"> |
|
|
| <head> |
| <meta charset="UTF-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| <title>Sleek UI Design Guidelines</title> |
| <style> |
| :root { |
| |
| --bg-primary: #000000; |
| --bg-secondary: #121212; |
| --bg-tertiary: #1c1c1e; |
| |
| --border-subtle: #2c2c2e; |
| --border-active: #3a3a3c; |
| |
| --text-primary: #ffffff; |
| --text-secondary: #8e8e93; |
| --text-tertiary: #48484a; |
| |
| --accent: #0a84ff; |
| --accent-soft: rgba(10, 132, 255, 0.1); |
| |
| --radius-sm: 6px; |
| --radius-md: 10px; |
| --radius-lg: 16px; |
| --radius-pill: 55px; |
| |
| --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; |
| --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); |
| } |
| |
| * { |
| margin: 0; |
| padding: 0; |
| box-sizing: border-box; |
| -webkit-font-smoothing: antialiased; |
| } |
| |
| body { |
| background-color: var(--bg-primary); |
| color: var(--text-primary); |
| font-family: var(--font-main); |
| line-height: 1.6; |
| overflow-x: hidden; |
| } |
| |
| |
| ::-webkit-scrollbar { |
| width: 8px; |
| } |
| |
| ::-webkit-scrollbar-track { |
| background: var(--bg-primary); |
| } |
| |
| ::-webkit-scrollbar-thumb { |
| background: var(--border-subtle); |
| border-radius: 10px; |
| } |
| |
| ::-webkit-scrollbar-thumb:hover { |
| background: var(--border-active); |
| } |
| |
| |
| .app-container { |
| display: grid; |
| grid-template-columns: 260px 1fr; |
| min-height: 100vh; |
| } |
| |
| |
| aside { |
| border-right: 1px solid var(--border-subtle); |
| padding: 2rem 1.5rem; |
| position: sticky; |
| top: 0; |
| height: 100vh; |
| background: var(--bg-primary); |
| } |
| |
| .brand { |
| font-size: 1.25rem; |
| font-weight: 600; |
| margin-bottom: 2.5rem; |
| display: flex; |
| align-items: center; |
| letter-spacing: -0.02em; |
| } |
| |
| .nav-list { |
| list-style: none; |
| } |
| |
| .nav-item { |
| margin-bottom: 0.5rem; |
| } |
| |
| .nav-link { |
| text-decoration: none; |
| color: var(--text-secondary); |
| font-size: 0.9rem; |
| display: block; |
| padding: 0.6rem 0.8rem; |
| border-radius: var(--radius-pill); |
| transition: var(--transition); |
| } |
| |
| .nav-link:hover { |
| color: var(--text-primary); |
| background: var(--bg-secondary); |
| } |
| |
| .nav-link.active { |
| color: var(--text-primary); |
| background: var(--bg-tertiary); |
| font-weight: 500; |
| } |
| |
| |
| main { |
| padding: 4rem 6rem; |
| max-width: 1200px; |
| } |
| |
| header { |
| margin-bottom: 4rem; |
| } |
| |
| h1 { |
| font-size: 3rem; |
| font-weight: 700; |
| letter-spacing: -0.04em; |
| margin-bottom: 1rem; |
| } |
| |
| .subtitle { |
| font-size: 1.25rem; |
| color: var(--text-secondary); |
| max-width: 600px; |
| } |
| |
| section { |
| margin-bottom: 5rem; |
| } |
| |
| h2 { |
| font-size: 0.85rem; |
| text-transform: uppercase; |
| letter-spacing: 0.15em; |
| color: var(--text-secondary); |
| margin-bottom: 2rem; |
| padding-bottom: 0.5rem; |
| } |
| |
| |
| .type-grid { |
| display: flex; |
| flex-direction: column; |
| gap: 2rem; |
| } |
| |
| .type-row { |
| display: grid; |
| grid-template-columns: 150px 1fr; |
| align-items: baseline; |
| } |
| |
| .label-small { |
| font-size: 0.75rem; |
| color: var(--text-tertiary); |
| font-weight: 600; |
| text-transform: uppercase; |
| letter-spacing: 0.05em; |
| } |
| |
| |
| .color-grid { |
| display: grid; |
| grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); |
| gap: 1.5rem; |
| } |
| |
| .color-card { |
| border-radius: var(--radius-md); |
| overflow: hidden; |
| transition: var(--transition); |
| } |
| |
| .color-card:hover { |
| border-color: var(--border-active); |
| } |
| |
| .swatch { |
| height: 100px; |
| } |
| |
| .color-info { |
| padding: 1rem; |
| background: var(--bg-secondary); |
| } |
| |
| .color-name { |
| font-size: 0.85rem; |
| font-weight: 500; |
| margin-bottom: 0.25rem; |
| } |
| |
| .color-hex { |
| font-size: 0.75rem; |
| color: var(--text-secondary); |
| font-family: monospace; |
| } |
| |
| |
| .component-grid { |
| display: grid; |
| grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); |
| gap: 2rem; |
| } |
| |
| .demo-card { |
| background: var(--bg-secondary); |
| border-radius: var(--radius-lg); |
| padding: 2rem; |
| display: flex; |
| flex-direction: column; |
| gap: 1.5rem; |
| } |
| |
| |
| .btn-group { |
| display: flex; |
| gap: 1rem; |
| flex-wrap: wrap; |
| align-items: center; |
| } |
| |
| button { |
| padding: 0.7rem 1.5rem; |
| border-radius: var(--radius-pill); |
| font-size: 0.9rem; |
| font-weight: 500; |
| cursor: pointer; |
| transition: var(--transition); |
| border: none; |
| } |
| |
| .btn-primary { |
| background: var(--text-primary); |
| color: var(--bg-primary); |
| } |
| |
| .btn-primary:hover { |
| background: #e5e5e5; |
| } |
| |
| .btn-secondary { |
| background: var(--bg-tertiary); |
| color: var(--text-primary); |
| } |
| |
| .btn-secondary:hover { |
| background: var(--border-active); |
| } |
| |
| .btn-outline { |
| background: transparent; |
| background: transparent; |
| color: var(--text-primary); |
| |
| } |
| |
| .btn-outline:hover { |
| background: var(--bg-secondary); |
| } |
| |
| |
| .tag { |
| display: inline-flex; |
| align-items: center; |
| padding: 0.3rem 0.9rem; |
| background: var(--bg-tertiary); |
| border-radius: var(--radius-pill); |
| font-size: 0.75rem; |
| color: var(--text-secondary); |
| font-weight: 500; |
| } |
| |
| |
| .input-field { |
| background: var(--bg-primary); |
| border: 1px solid var(--border-subtle); |
| color: var(--text-primary); |
| padding: 0.75rem 1rem; |
| border-radius: var(--radius-sm); |
| width: 100%; |
| outline: none; |
| transition: var(--transition); |
| font-size: 0.9rem; |
| } |
| |
| .input-field:focus { |
| border-color: var(--accent); |
| } |
| |
| |
| .toggle { |
| position: relative; |
| display: inline-block; |
| width: 44px; |
| height: 24px; |
| } |
| |
| .toggle input { |
| opacity: 0; |
| width: 0; |
| height: 0; |
| } |
| |
| .slider { |
| position: absolute; |
| cursor: pointer; |
| top: 0; |
| left: 0; |
| right: 0; |
| bottom: 0; |
| background-color: var(--bg-tertiary); |
| transition: .3s; |
| border-radius: 34px; |
| border: 1px solid var(--border-subtle); |
| } |
| |
| .slider:before { |
| position: absolute; |
| content: ""; |
| height: 18px; |
| width: 18px; |
| left: 2px; |
| bottom: 2px; |
| background-color: white; |
| transition: .3s; |
| border-radius: 50%; |
| } |
| |
| input:checked+.slider { |
| background-color: var(--accent); |
| border-color: var(--accent); |
| } |
| |
| input:checked+.slider:before { |
| transform: translateX(20px); |
| } |
| |
| |
| .checkbox-container { |
| display: flex; |
| align-items: center; |
| cursor: pointer; |
| gap: 0.75rem; |
| font-size: 0.9rem; |
| color: var(--text-secondary); |
| } |
| |
| .checkbox-container input { |
| display: none; |
| } |
| |
| .checkmark { |
| height: 20px; |
| width: 20px; |
| background-color: var(--bg-primary); |
| border: 1px solid var(--border-subtle); |
| border-radius: 4px; |
| display: flex; |
| align-items: center; |
| justify-content: center; |
| } |
| |
| .checkbox-container input:checked+.checkmark { |
| background-color: var(--accent); |
| border-color: var(--accent); |
| } |
| |
| .checkmark svg { |
| width: 12px; |
| height: 12px; |
| fill: none; |
| stroke: white; |
| stroke-width: 3; |
| display: none; |
| } |
| |
| .checkbox-container input:checked+.checkmark svg { |
| display: block; |
| } |
| |
| |
| input[type=range] { |
| -webkit-appearance: none; |
| appearance: none; |
| width: 100%; |
| background: transparent; |
| } |
| |
| input[type=range]::-webkit-slider-runnable-track { |
| width: 100%; |
| height: 4px; |
| background: var(--bg-tertiary); |
| border-radius: 2px; |
| } |
| |
| input[type=range]::-webkit-slider-thumb { |
| -webkit-appearance: none; |
| height: 18px; |
| width: 18px; |
| border-radius: 50%; |
| background: var(--text-primary); |
| cursor: pointer; |
| margin-top: -7px; |
| } |
| |
| |
| .search-wrapper { |
| position: relative; |
| width: 100%; |
| max-width: 300px; |
| } |
| |
| .search-icon { |
| position: absolute; |
| left: 12px; |
| top: 50%; |
| transform: translateY(-50%); |
| color: var(--text-secondary); |
| width: 16px; |
| height: 16px; |
| } |
| |
| .search-input { |
| width: 100%; |
| background: var(--bg-tertiary); |
| border: none; |
| padding: 0.6rem 1rem 0.6rem 2.5rem; |
| border-radius: var(--radius-pill); |
| color: var(--text-primary); |
| font-size: 0.9rem; |
| transition: var(--transition); |
| } |
| |
| .search-input:focus { |
| background: var(--bg-primary); |
| outline: none; |
| } |
| |
| |
| .icon-btn-group { |
| display: flex; |
| gap: 0.5rem; |
| } |
| |
| .icon-btn { |
| background: transparent; |
| color: var(--text-secondary); |
| width: 36px; |
| height: 36px; |
| display: flex; |
| align-items: center; |
| justify-content: center; |
| border-radius: 50%; |
| transition: var(--transition); |
| padding: 0; |
| } |
| |
| .icon-btn:hover { |
| background: var(--bg-tertiary); |
| color: var(--text-primary); |
| } |
| |
| .icon-btn.active { |
| color: var(--accent); |
| background: var(--accent-soft); |
| } |
| |
| .icon-btn svg { |
| width: 18px; |
| height: 18px; |
| fill: none; |
| stroke: currentColor; |
| stroke-width: 2; |
| stroke-linecap: round; |
| stroke-linejoin: round; |
| } |
| |
| |
| .pfp-list { |
| display: flex; |
| gap: -10px; |
| } |
| |
| .pfp { |
| width: 48px; |
| height: 48px; |
| border-radius: 50%; |
| border: 2px solid var(--bg-secondary); |
| margin-right: -12px; |
| object-fit: cover; |
| transition: transform 0.2s; |
| } |
| |
| .pfp:hover { |
| transform: translateY(-4px); |
| z-index: 10; |
| } |
| |
| |
| |
| |
| .code-container { |
| position: relative; |
| background: #0a0a0a; |
| border-radius: var(--radius-md); |
| overflow: hidden; |
| margin-top: 1rem; |
| } |
| |
| .code-header { |
| display: flex; |
| justify-content: space-between; |
| align-items: center; |
| padding: 0.5rem 1rem; |
| background: var(--bg-tertiary); |
| } |
| |
| .code-lang { |
| font-size: 0.7rem; |
| color: var(--text-tertiary); |
| font-weight: 700; |
| text-transform: uppercase; |
| } |
| |
| .copy-btn { |
| background: transparent; |
| border: none; |
| color: var(--text-secondary); |
| cursor: pointer; |
| padding: 4px; |
| display: flex; |
| align-items: center; |
| justify-content: center; |
| transition: var(--transition); |
| border-radius: 4px; |
| } |
| |
| .copy-btn:hover { |
| background: var(--bg-secondary); |
| color: var(--text-primary); |
| } |
| |
| pre { |
| padding: 1.5rem; |
| font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; |
| font-size: 0.85rem; |
| line-height: 1.5; |
| overflow-x: auto; |
| color: #d1d1d1; |
| } |
| |
| .token-keyword { |
| color: #ff79c6; |
| } |
| |
| .token-string { |
| color: #f1fa8c; |
| } |
| |
| .token-function { |
| color: #50fa7b; |
| } |
| |
| .token-comment { |
| color: #6272a4; |
| } |
| |
| |
| .media-grid { |
| display: grid; |
| grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); |
| gap: 2rem; |
| } |
| |
| .image-card { |
| border-radius: var(--radius-lg); |
| overflow: hidden; |
| background: var(--bg-secondary); |
| transition: var(--transition); |
| } |
| |
| .image-card img { |
| width: 100%; |
| height: 200px; |
| object-fit: cover; |
| display: block; |
| } |
| |
| .image-content { |
| padding: 1.5rem; |
| } |
| |
| .image-title { |
| font-size: 1rem; |
| font-weight: 600; |
| margin-bottom: 0.5rem; |
| color: var(--text-primary); |
| } |
| |
| .image-desc { |
| font-size: 0.85rem; |
| color: var(--text-secondary); |
| } |
| |
| |
| @media (max-width: 1024px) { |
| .app-container { |
| grid-template-columns: 1fr; |
| } |
| |
| aside { |
| display: none; |
| } |
| |
| main { |
| padding: 3rem 2rem; |
| } |
| |
| .component-grid { |
| grid-template-columns: 1fr; |
| } |
| } |
| |
| |
| .toast { |
| position: fixed; |
| bottom: 2rem; |
| right: 2rem; |
| background: var(--accent); |
| color: white; |
| padding: 0.75rem 1.5rem; |
| border-radius: var(--radius-sm); |
| font-size: 0.85rem; |
| font-weight: 500; |
| transform: translateY(100px); |
| transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); |
| z-index: 1000; |
| } |
| |
| .toast.show { |
| transform: translateY(0); |
| } |
| </style> |
| </head> |
|
|
| <body> |
|
|
| <div class="app-container"> |
| <aside> |
| <div class="brand">System·UI</div> |
| <nav> |
| <ul class="nav-list"> |
| <li class="nav-item"><a href="#typography" class="nav-link active">Typography</a></li> |
| <li class="nav-item"><a href="#colors" class="nav-link">Colors</a></li> |
| <li class="nav-item"><a href="#components" class="nav-link">Components</a></li> |
| <li class="nav-item"><a href="#images" class="nav-link">Images & Content</a></li> |
| <li class="nav-item"><a href="#controls" class="nav-link">Controls</a></li> |
| <li class="nav-item"><a href="#dev" class="nav-link">Development</a></li> |
| </ul> |
| </nav> |
| </aside> |
|
|
| <main> |
| <header> |
| <h1>Design Guidelines</h1> |
| <p class="subtitle">A minimalist design system focusing on clarity, flat pill-shaped interfaces, and |
| high-fidelity interactions.</p> |
| </header> |
|
|
| <section id="typography"> |
| <h2>Typography</h2> |
| <div class="type-grid"> |
| <div class="type-row"> |
| <span class="label-small">DISPLAY</span> |
| <h1 style="margin:0; font-size: 2.5rem;">The quick brown fox.</h1> |
| </div> |
| <div class="type-row"> |
| <span class="label-small">BODY</span> |
| <p style="color: var(--text-secondary);">Grumpy wizards make toxic brew for the evil Queen and |
| Jack. Everything is perfectly legible and spaced.</p> |
| </div> |
| </div> |
| </section> |
|
|
| <section id="colors"> |
| <h2>Color Palette</h2> |
| <div class="color-grid"> |
| <div class="color-card copyable" data-hex="#000000"> |
| <div class="swatch" style="background: #000000;"></div> |
| <div class="color-info"> |
| <div class="color-name">Black</div> |
| <div class="color-hex">#000000</div> |
| </div> |
| </div> |
| <div class="color-card copyable" data-hex="#0a84ff"> |
| <div class="swatch" style="background: #0a84ff;"></div> |
| <div class="color-info"> |
| <div class="color-name">Accent</div> |
| <div class="color-hex">#0A84FF</div> |
| </div> |
| </div> |
| </div> |
| </section> |
|
|
| <section id="components"> |
| <h2>Standard Components</h2> |
| <div class="component-grid"> |
| <div class="demo-card"> |
| <span class="label-small">BUTTONS</span> |
| <div class="btn-group"> |
| <button class="btn-primary">Primary Action</button> |
| <button class="btn-secondary">Secondary</button> |
| </div> |
| <span class="label-small">BADGES</span> |
| <div class="btn-group"> |
| <span class="tag">Status</span> |
| <span class="tag" |
| style="color: var(--accent); background: var(--accent-soft);">Feature</span> |
| <span class="tag">v.1.0</span> |
| </div> |
| </div> |
| <div class="demo-card"> |
| <span class="label-small">AVATARS</span> |
| <div class="pfp-list"> |
| <img src="pfps/anime_pfp1.png" alt="User 1" class="pfp"> |
| <img src="pfps/anime_pfp2.png" alt="User 2" class="pfp"> |
| <img src="pfps/anime_pfp3.png" alt="User 3" class="pfp"> |
| <img src="pfps/anime_pfp4.png" alt="User 4" class="pfp"> |
| <img src="pfps/anime_pfp5.png" alt="User 5" class="pfp"> |
| <img src="pfps/anime_pfp6.png" alt="User 6" class="pfp"> |
| </div> |
| </div> |
| </div> |
| |
| <h2 style="margin-top: 4rem;">Interactive</h2> |
| <div class="component-grid"> |
| <div class="demo-card"> |
| <span class="label-small">SEARCH</span> |
| <div class="search-wrapper"> |
| <svg class="search-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" |
| stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> |
| <circle cx="11" cy="11" r="8"></circle> |
| <line x1="21" y1="21" x2="16.65" y2="16.65"></line> |
| </svg> |
| <input type="text" class="search-input" placeholder="Search..."> |
| </div> |
| </div> |
| <div class="demo-card"> |
| <span class="label-small">ACTIONS</span> |
| <div class="icon-btn-group"> |
| <button class="icon-btn" aria-label="Like"> |
| <svg viewBox="0 0 24 24"> |
| <path |
| d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"> |
| </path> |
| </svg> |
| </button> |
| <button class="icon-btn active" aria-label="Bookmark"> |
| <svg viewBox="0 0 24 24"> |
| <path d="M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"></path> |
| </svg> |
| </button> |
| <button class="icon-btn" aria-label="Share"> |
| <svg viewBox="0 0 24 24"> |
| <circle cx="18" cy="5" r="3"></circle> |
| <circle cx="6" cy="12" r="3"></circle> |
| <circle cx="18" cy="19" r="3"></circle> |
| <line x1="8.59" y1="13.51" x2="15.42" y2="17.49"></line> |
| <line x1="15.41" y1="6.51" x2="8.59" y2="10.49"></line> |
| </svg> |
| </button> |
| <button class="icon-btn" aria-label="More"> |
| <svg viewBox="0 0 24 24"> |
| <circle cx="12" cy="12" r="1"></circle> |
| <circle cx="12" cy="5" r="1"></circle> |
| <circle cx="12" cy="19" r="1"></circle> |
| </svg> |
| </button> |
| </div> |
|
|
| </section> |
|
|
| <section id="images"> |
| <h2>Images & Content</h2> |
| <div class="media-grid"> |
| <div class="image-card"> |
| <img src="trees.jpg" alt="Nature"> |
| <div class="image-content"> |
| <div class="image-title">Full Width Media</div> |
| <div class="image-desc">Images should span the full width of their container with consistent |
| rounded corners.</div> |
| </div> |
| </div> |
| <div class="demo-card"> |
| <span class="label-small">USER CONTENT</span> |
| <div style="display: flex; gap: 1rem; align-items: flex-start; margin-top: 0.5rem;"> |
| <img src="pfps/anime_pfp1.png" |
| style="width: 40px; height: 40px; border-radius: 50%; object-fit: cover;" alt="User"> |
| <div> |
| <div style="font-weight: 600; font-size: 0.9rem; margin-bottom: 0.2rem;">System User |
| </div> |
| <div style="font-size: 0.85rem; color: var(--text-secondary); line-height: 1.4;"> |
| Content structure should follow a clear hierarchy. Images combined with text create |
| engaging layouts. |
| </div> |
| <img src="trees.jpg" |
| style="width: 100%; border-radius: var(--radius-md); margin-top: 1rem; height: 150px; object-fit: cover;" |
| alt="Content Image"> |
| </div> |
| </div> |
| </div> |
| </div> |
| </section> |
|
|
| <section id="controls"> |
| <h2>Input & Controls</h2> |
| <div class="component-grid"> |
| <div class="demo-card"> |
| <span class="label-small">FORM ELEMENTS</span> |
| <div style="display: flex; flex-direction: column; gap: 1.25rem;"> |
| <input type="text" class="input-field" placeholder="Username"> |
| <select class="input-field" style="appearance: none;"> |
| <option>Select Location</option> |
| <option>North America</option> |
| <option>Europe</option> |
| </select> |
| <label class="checkbox-container"> |
| <input type="checkbox" checked> |
| <div class="checkmark"> |
| <svg viewBox="0 0 24 24"> |
| <path d="M20 6L9 17l-5-5" /> |
| </svg> |
| </div> |
| Subscribe to newsletter |
| </label> |
| </div> |
| </div> |
| <div class="demo-card"> |
| <span class="label-small">INTERACTIVE CONTROLS</span> |
| <div style="display: flex; flex-direction: column; gap: 1.5rem;"> |
| <div style="display: flex; align-items: center; gap: 1rem;"> |
| <label class="toggle"> |
| <input type="checkbox" checked> |
| <span class="slider"></span> |
| </label> |
| <span style="font-size: 0.9rem; color: var(--text-secondary);">Dark Mode</span> |
| </div> |
| <div style="display: flex; flex-direction: column; gap: 0.5rem;"> |
| <div style="display: flex; justify-content: space-between;"> |
| <span class="label-small">BRIGHTNESS</span> |
| <span class="label-small">80%</span> |
| </div> |
| <input type="range" min="0" max="100" value="80"> |
| </div> |
| </div> |
| </div> |
| </div> |
| </section> |
|
|
| <section id="dev"> |
| <h2>Code Guidelines</h2> |
| <div class="code-container"> |
| <div class="code-header"> |
| <span class="code-lang">JavaScript</span> |
| <button class="copy-btn" id="copyCode"> |
| <svg class="icon-copy" width="16" height="16" viewBox="0 0 24 24" fill="none" |
| stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> |
| <rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect> |
| <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path> |
| </svg> |
| <svg class="icon-check" width="16" height="16" viewBox="0 0 24 24" fill="none" |
| stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" |
| style="display:none; color: var(--accent);"> |
| <polyline points="20 6 9 17 4 12"></polyline> |
| </svg> |
| </button> |
| </div> |
| <pre id="codeContent"><span class="token-keyword">const</span> theme = { |
| name: <span class="token-string">'Minimal'</span>, |
| borderRadius: <span class="token-string">'55px'</span>, |
| shadows: <span class="token-keyword">false</span>, |
| <span class="token-function">init</span>() { |
| console.<span class="token-function">log</span>(<span class="token-string">'Design system loaded'</span>); |
| } |
| };</pre> |
| </div> |
| </section> |
| </main> |
| </div> |
|
|
| <div id="toast" class="toast">Copied to clipboard</div> |
|
|
| <script> |
| |
| const colorCards = document.querySelectorAll('.color-card.copyable'); |
| const toast = document.getElementById('toast'); |
| |
| colorCards.forEach(card => { |
| card.addEventListener('click', () => { |
| const hex = card.getAttribute('data-hex'); |
| copyToClipboard(hex); |
| showToast(`Copied ${hex}`); |
| }); |
| }); |
| |
| |
| const copyBtn = document.getElementById('copyCode'); |
| const codeContent = document.getElementById('codeContent'); |
| const iconCopy = copyBtn.querySelector('.icon-copy'); |
| const iconCheck = copyBtn.querySelector('.icon-check'); |
| |
| copyBtn.addEventListener('click', () => { |
| const text = codeContent.innerText; |
| copyToClipboard(text); |
| |
| |
| iconCopy.style.display = 'none'; |
| iconCheck.style.display = 'block'; |
| |
| setTimeout(() => { |
| iconCopy.style.display = 'block'; |
| iconCheck.style.display = 'none'; |
| }, 2000); |
| }); |
| |
| function copyToClipboard(text) { |
| const tempInput = document.createElement('textarea'); |
| tempInput.value = text; |
| document.body.appendChild(tempInput); |
| tempInput.select(); |
| document.execCommand('copy'); |
| document.body.removeChild(tempInput); |
| } |
| |
| function showToast(msg) { |
| toast.textContent = msg; |
| toast.classList.add('show'); |
| setTimeout(() => toast.classList.remove('show'), 2000); |
| } |
| |
| |
| const navLinks = document.querySelectorAll('.nav-link'); |
| window.addEventListener('scroll', () => { |
| let current = ""; |
| const sections = document.querySelectorAll('section'); |
| sections.forEach(section => { |
| if (pageYOffset >= section.offsetTop - 150) { |
| current = section.getAttribute('id'); |
| } |
| }); |
| navLinks.forEach(link => { |
| link.classList.remove('active'); |
| if (link.getAttribute('href').includes(current)) { |
| link.classList.add('active'); |
| } |
| }); |
| }); |
| </script> |
| </body> |
|
|
| </html> |