forked from withastro/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration page headers (withastro#5676)
* Stash work where dev server crashes were happening * Fix up icons * Add title styling * Add `id` to `<h1>` override * Hide npm icon from a11y tree * Fix `id` typo * Fix layout on small viewports
- Loading branch information
Showing
2 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
--- | ||
import type { Props } from '@astrojs/starlight/props'; | ||
import { Icon } from '@astrojs/starlight/components'; | ||
import Default from '@astrojs/starlight/components/PageTitle.astro'; | ||
import Version from '../Version.astro'; | ||
const { data } = Astro.props.entry; | ||
--- | ||
|
||
{ | ||
data.type === 'integration' ? ( | ||
<div class="wrapper"> | ||
<h1 id="_top"> | ||
<> | ||
<span class="scope">@astrojs/</span> | ||
<span>{data.title.replace('@astrojs/', '')}</span> | ||
</> | ||
</h1> | ||
<div class="integration-metadata"> | ||
<Version pkgName={data.title} /> | ||
<a href={data.githubURL}> | ||
<Icon size="1rem" name="github" /> GitHub | ||
</a> | ||
<a href={'https://www.npmjs.com/package/' + data.title}> | ||
<svg width="16" height="16" viewBox="0 0 576 512" fill="currentColor" aria-hidden="true"> | ||
<path d="M288 288h-32v-64h32v64zm288-128v192H288v32H160v-32H0V160h576zm-416 32H32v128h64v-96h32v96h32V192zm160 0H192v160h64v-32h64V192zm224 0H352v128h64v-96h32v96h32v-96h32v96h32V192z" /> | ||
</svg> | ||
npm | ||
</a> | ||
<a href={data.githubURL + 'CHANGELOG.md'}> | ||
<Icon size="1rem" name="list-format" /> Changelog | ||
</a> | ||
</div> | ||
</div> | ||
) : ( | ||
<Default {...Astro.props}> | ||
<slot /> | ||
</Default> | ||
) | ||
} | ||
|
||
<style> | ||
.wrapper { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 0.5rem; | ||
} | ||
h1 { | ||
display: flex; | ||
flex-wrap: wrap; | ||
color: var(--sl-color-white); | ||
font-size: var(--sl-text-h1); | ||
font-weight: 600; | ||
line-height: var(--sl-line-height-headings); | ||
} | ||
.scope { | ||
color: var(--sl-color-text); | ||
font-weight: 400; | ||
} | ||
.integration-metadata { | ||
display: flex; | ||
flex-wrap: wrap; | ||
align-items: center; | ||
gap: 0.5rem 1rem; | ||
font-size: var(--sl-text-xs); | ||
} | ||
.integration-metadata a { | ||
display: flex; | ||
align-items: center; | ||
gap: 0.25rem; | ||
text-decoration: none; | ||
color: var(--sl-color-text-accent); | ||
} | ||
.integration-metadata a:hover { | ||
color: var(--sl-color-white); | ||
} | ||
.integration-metadata svg { | ||
width: 1.5rem; | ||
} | ||
</style> |