-
Notifications
You must be signed in to change notification settings - Fork 512
feat(home): replace hero image with a real, highlighted code block #878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
54ebfa7
3e03129
bf79c32
cab9107
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <script setup lang="ts"> | ||
| import DefaultTheme from 'vitepress/theme' | ||
| import HeroImage from './components/HeroImage.vue' | ||
|
|
||
| const { Layout } = DefaultTheme | ||
| </script> | ||
|
|
||
| <template> | ||
| <Layout> | ||
| <template #home-hero-image> | ||
| <HeroImage /> | ||
| </template> | ||
| </Layout> | ||
| </template> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| <script setup lang="ts"> | ||
| // Hero snippet highlighted at build time and frozen as static HTML, so there's | ||
| // no client-side highlighting (and no flash). Generated with shiki — the engine | ||
| // VitePress uses — and the same themes from `.vitepress/config.ts`: | ||
| // | ||
| // codeToHtml(snippet, { | ||
| // lang: 'ts', | ||
| // themes: { light: 'github-light', dark: 'github-dark' }, | ||
| // defaultColor: false, | ||
| // }) | ||
| // | ||
| // Re-run that and paste the result here to change the snippet. | ||
| const codeHtml = `<pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> { Hono } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> 'hono'</span></span> | ||
| <span class="line"></span> | ||
| <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">const</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> app</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> =</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> new</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Hono</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">()</span></span> | ||
| <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">app.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">get</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'/'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, (</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">c</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">=></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> c.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">text</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'Hello Hono!'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">))</span></span> | ||
| <span class="line"></span> | ||
| <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> default</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> app</span></span></code></pre>` | ||
|
|
||
| // Kept in sync with the kawaii image handled by the toggle in `.vitepress/config.ts`. | ||
| const kawaiiAlt = | ||
| 'A Kawaii Version of the Hono Logo. The first "o" is replaced with a flame, with japanese characters in the bottom right, and a JSX fragment closing tag above the flame.' | ||
| </script> | ||
|
|
||
| <template> | ||
| <div class="hero-image-slot"> | ||
| <div class="hero-code-window"> | ||
| <div class="hero-code-titlebar" aria-hidden="true"> | ||
| <span class="hero-code-dot hero-code-dot--red" /> | ||
| <span class="hero-code-dot hero-code-dot--yellow" /> | ||
| <span class="hero-code-dot hero-code-dot--green" /> | ||
| </div> | ||
| <div class="hero-code-body" v-html="codeHtml" /> | ||
| </div> | ||
| <img class="hero-kawaii" src="/images/hono-kawaii.png" :alt="kawaiiAlt" /> | ||
| </div> | ||
| </template> |
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure! I've prepared a few proposals. Happy to apply whichever you prefer. Here are the options for the code block background in light mode:
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I love "2. Keep the current color + add a subtle shadow"! It's the best. I also want to see the dark-mode pattern.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Glad you like option 2! The shadow version is already committed.
Also, a heads-up: while making these changes I noticed this PR had Let me know if anything else needs changing. |





Uh oh!
There was an error while loading. Please reload this page.