|
| 1 | +{{#> base title="launch.css" }} |
| 2 | +<main> |
| 3 | + <section id="getting-started"> |
| 4 | + <h2>Installation</h2> |
| 5 | + <p>You can install launch.css using your preferred package manager:</p> |
| 6 | + |
| 7 | + <pre><code class="language-shell">npx nypm add launch.css</code></pre> |
| 8 | + |
| 9 | + <p>Or use a CDN:</p> |
| 10 | + <pre |
| 11 | + ><code class="language-html"><link rel="stylesheet" href="https://unpkg.com/launch.css" /></code></pre> |
| 12 | + |
| 13 | + <h3>Basic Setup</h3> |
| 14 | + <p>Import the library in your main JavaScript file:</p> |
| 15 | + |
| 16 | + <pre><code class="language-js">import "@launch.css";</code></pre> |
| 17 | + |
| 18 | + <p>Use one of the layouts:</p> |
| 19 | + <div> |
| 20 | + <button data-layout-switcher="website">Website Layout</button> |
| 21 | + <button data-layout-switcher="dashboard">Dashboard Layout</button> |
| 22 | + </div> |
| 23 | + <pre |
| 24 | + ><code class="language-html"><body data-layout="website"></code></pre> |
| 25 | + <pre |
| 26 | + ><code class="language-html"><body data-layout="dashboard"></code></pre> |
| 27 | + </section> |
| 28 | + |
| 29 | + <section id="themes-layouts"> |
| 30 | + <h2>Themes</h2> |
| 31 | + <p> |
| 32 | + launch.css supports light and dark themes with seamless switching: |
| 33 | + </p> |
| 34 | + |
| 35 | + <div> |
| 36 | + <button data-theme-switcher="light">Light Theme</button> |
| 37 | + <button data-theme-switcher="dark">Dark Theme</button> |
| 38 | + </div> |
| 39 | + |
| 40 | + <h4>Theme Switching Code</h4> |
| 41 | + <pre |
| 42 | + ><code class="language-html"><html data-theme="dark"></code></pre> |
| 43 | + <pre |
| 44 | + ><code class="language-html"><html data-theme="light"></code></pre> |
| 45 | + </section> |
| 46 | +</main> |
| 47 | +<script> |
| 48 | +for (const element of document.querySelectorAll("[data-theme-switcher]")) { |
| 49 | + element.addEventListener("click", () => { |
| 50 | + document.documentElement.setAttribute( |
| 51 | + "data-theme", |
| 52 | + element.dataset.themeSwitcher, |
| 53 | + ); |
| 54 | + }); |
| 55 | +} |
| 56 | + |
| 57 | +for (const element of document.querySelectorAll("[data-layout-switcher]")) { |
| 58 | + element.addEventListener("click", () => { |
| 59 | + document.body.setAttribute( |
| 60 | + "data-layout", |
| 61 | + element.dataset.layoutSwitcher, |
| 62 | + ); |
| 63 | + }); |
| 64 | +} |
| 65 | +</script> |
| 66 | +{{/base}} |
0 commit comments