|
| 1 | +import { LitElement, css, html } from 'lit' |
| 2 | +import { customElement, property } from 'lit/decorators.js' |
| 3 | +import litLogo from './assets/lit.svg' |
| 4 | + |
| 5 | +/** |
| 6 | + * An example element. |
| 7 | + * |
| 8 | + * @slot - This element has a slot |
| 9 | + * @csspart button - The button |
| 10 | + */ |
| 11 | +@customElement('my-element') |
| 12 | +export class MyElement extends LitElement { |
| 13 | + /** |
| 14 | + * Copy for the read the docs hint. |
| 15 | + */ |
| 16 | + @property() |
| 17 | + docsHint = 'Click on the Vite and Lit logos to learn more' |
| 18 | + |
| 19 | + /** |
| 20 | + * The number of times the button has been clicked. |
| 21 | + */ |
| 22 | + @property({ type: Number }) |
| 23 | + count = 0 |
| 24 | + |
| 25 | + render() { |
| 26 | + return html` |
| 27 | + <main class="flex min-h-screen flex-col items-center justify-between p-24"> |
| 28 | + <div class="z-10 w-full max-w-5xl items-center justify-between font-mono text-sm lg:flex"> |
| 29 | + <p |
| 30 | + class="fixed left-0 top-0 flex w-full justify-center border-b border-gray-300 bg-gradient-to-b from-zinc-200 pb-6 pt-8 backdrop-blur-2xl dark:border-neutral-800 dark:bg-zinc-800/30 dark:from-inherit lg:static lg:w-auto lg:rounded-xl lg:border lg:bg-gray-200 lg:p-4 lg:dark:bg-zinc-800/30" |
| 31 | + > |
| 32 | + Get started by editing |
| 33 | + <code class="font-mono font-bold">pages/index.tsx</code> |
| 34 | + </p> |
| 35 | + <div |
| 36 | + class="fixed bottom-0 left-0 flex h-48 w-full items-end justify-center bg-gradient-to-t from-white via-white dark:from-black dark:via-black lg:static lg:h-auto lg:w-auto lg:bg-none" |
| 37 | + > |
| 38 | + <a |
| 39 | + class="pointer-events-none flex place-items-center gap-2 p-8 lg:pointer-events-auto lg:p-0" |
| 40 | + href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template-tw&utm_campaign=create-next-app" |
| 41 | + target="_blank" |
| 42 | + rel="noopener noreferrer" |
| 43 | + > |
| 44 | + By |
| 45 | + <img src="${litLogo}" alt="Vercel Logo" class="dark:invert" priority /> |
| 46 | + </a> |
| 47 | + </div> |
| 48 | + </div> |
| 49 | +
|
| 50 | + <div |
| 51 | + class="relative flex place-items-center before:absolute before:h-[300px] before:w-[480px] before:-translate-x-1/2 before:rounded-full before:bg-gradient-radial before:from-white before:to-transparent before:blur-2xl before:content-[''] after:absolute after:-z-20 after:h-[180px] after:w-[240px] after:translate-x-1/3 after:bg-gradient-conic after:from-sky-200 after:via-blue-200 after:blur-2xl after:content-[''] before:dark:bg-gradient-to-br before:dark:from-transparent before:dark:to-blue-700/10 after:dark:from-sky-900 after:dark:via-[#0141ff]/40 before:lg:h-[360px]" |
| 52 | + > |
| 53 | + <img class="relative dark:drop-shadow-[0_0_0.3rem_#ffffff70] dark:invert" src="${'/vite.svg'}" alt="Next.js Logo" priority /> |
| 54 | + </div> |
| 55 | +
|
| 56 | + <div class="mb-32 grid text-center lg:mb-0 lg:grid-cols-4 lg:text-left"> |
| 57 | + <a |
| 58 | + href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=default-template-tw&utm_campaign=create-next-app" |
| 59 | + class="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30" |
| 60 | + target="_blank" |
| 61 | + rel="noopener noreferrer" |
| 62 | + > |
| 63 | + <h2 class="mb-3 text-2xl font-semibold">Docs <span class="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">-></span></h2> |
| 64 | + <p class="m-0 max-w-[30ch] text-sm opacity-50">Find in-depth information about Next.js features and API.</p> |
| 65 | + </a> |
| 66 | +
|
| 67 | + <a |
| 68 | + href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=default-template-tw&utm_campaign=create-next-app" |
| 69 | + class="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30" |
| 70 | + target="_blank" |
| 71 | + rel="noopener noreferrer" |
| 72 | + > |
| 73 | + <h2 class="mb-3 text-2xl font-semibold">Learn <span class="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">-></span></h2> |
| 74 | + <p class="m-0 max-w-[30ch] text-sm opacity-50">Learn about Next.js in an interactive course with quizzes!</p> |
| 75 | + </a> |
| 76 | +
|
| 77 | + <a |
| 78 | + href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=default-template-tw&utm_campaign=create-next-app" |
| 79 | + class="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30" |
| 80 | + target="_blank" |
| 81 | + rel="noopener noreferrer" |
| 82 | + > |
| 83 | + <h2 class="mb-3 text-2xl font-semibold"> |
| 84 | + Templates <span class="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">-></span> |
| 85 | + </h2> |
| 86 | + <p class="m-0 max-w-[30ch] text-sm opacity-50">Discover and deploy boilerplate example Next.js projects.</p> |
| 87 | + </a> |
| 88 | +
|
| 89 | + <a |
| 90 | + href="https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template-tw&utm_campaign=create-next-app" |
| 91 | + class="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30" |
| 92 | + target="_blank" |
| 93 | + rel="noopener noreferrer" |
| 94 | + > |
| 95 | + <h2 class="mb-3 text-2xl font-semibold">Deploy <span class="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">-></span></h2> |
| 96 | + <p class="m-0 max-w-[30ch] text-sm opacity-50">Instantly deploy your Next.js site to a shareable URL with Vercel.</p> |
| 97 | + </a> |
| 98 | + </div> |
| 99 | + </main> |
| 100 | + ` |
| 101 | + } |
| 102 | + |
| 103 | + private _onClick() { |
| 104 | + this.count++ |
| 105 | + } |
| 106 | + |
| 107 | + static styles = css` |
| 108 | + :host { |
| 109 | + max-width: 1280px; |
| 110 | + margin: 0 auto; |
| 111 | + padding: 2rem; |
| 112 | + text-align: center; |
| 113 | + } |
| 114 | +
|
| 115 | + .logo { |
| 116 | + height: 6em; |
| 117 | + padding: 1.5em; |
| 118 | + will-change: filter; |
| 119 | + transition: filter 300ms; |
| 120 | + } |
| 121 | + .logo:hover { |
| 122 | + filter: drop-shadow(0 0 2em #646cffaa); |
| 123 | + } |
| 124 | + .logo.lit:hover { |
| 125 | + filter: drop-shadow(0 0 2em #325cffaa); |
| 126 | + } |
| 127 | +
|
| 128 | + .card { |
| 129 | + padding: 2em; |
| 130 | + } |
| 131 | +
|
| 132 | + .read-the-docs { |
| 133 | + color: #888; |
| 134 | + } |
| 135 | +
|
| 136 | + h1 { |
| 137 | + font-size: 3.2em; |
| 138 | + line-height: 1.1; |
| 139 | + } |
| 140 | +
|
| 141 | + a { |
| 142 | + font-weight: 500; |
| 143 | + color: #646cff; |
| 144 | + text-decoration: inherit; |
| 145 | + } |
| 146 | + a:hover { |
| 147 | + color: #535bf2; |
| 148 | + } |
| 149 | +
|
| 150 | + button { |
| 151 | + border-radius: 8px; |
| 152 | + border: 1px solid transparent; |
| 153 | + padding: 0.6em 1.2em; |
| 154 | + font-size: 1em; |
| 155 | + font-weight: 500; |
| 156 | + font-family: inherit; |
| 157 | + background-color: #1a1a1a; |
| 158 | + cursor: pointer; |
| 159 | + transition: border-color 0.25s; |
| 160 | + } |
| 161 | + button:hover { |
| 162 | + border-color: #646cff; |
| 163 | + } |
| 164 | + button:focus, |
| 165 | + button:focus-visible { |
| 166 | + outline: 4px auto -webkit-focus-ring-color; |
| 167 | + } |
| 168 | +
|
| 169 | + @media (prefers-color-scheme: light) { |
| 170 | + a:hover { |
| 171 | + color: #747bff; |
| 172 | + } |
| 173 | + button { |
| 174 | + background-color: #f9f9f9; |
| 175 | + } |
| 176 | + } |
| 177 | + ` |
| 178 | +} |
| 179 | + |
| 180 | +declare global { |
| 181 | + interface HTMLElementTagNameMap { |
| 182 | + 'my-element': MyElement |
| 183 | + } |
| 184 | +} |
0 commit comments