[ci] format
This commit is contained in:
parent
0dcdc6fb1e
commit
dcdeca56ac
17 changed files with 187 additions and 167 deletions
|
@ -40,11 +40,13 @@ const {
|
|||
{heroImage && <img width={720} height={360} src={heroImage} alt="" />}
|
||||
<h1 class="title">{title}</h1>
|
||||
{pubDate && <time>{pubDate}</time>}
|
||||
{updatedDate && (
|
||||
{
|
||||
updatedDate && (
|
||||
<div>
|
||||
Last updated on <time>{updatedDate}</time>
|
||||
</div>
|
||||
)}
|
||||
)
|
||||
}
|
||||
<hr />
|
||||
<slot />
|
||||
</article>
|
||||
|
|
|
@ -37,7 +37,8 @@ const posts = (await Astro.glob('./blog/*.{md,mdx}')).sort(
|
|||
<main>
|
||||
<section>
|
||||
<ul>
|
||||
{posts.map((post) => (
|
||||
{
|
||||
posts.map((post) => (
|
||||
<li>
|
||||
<time datetime={post.frontmatter.pubDate}>
|
||||
{new Date(post.frontmatter.pubDate).toLocaleDateString('en-us', {
|
||||
|
@ -48,7 +49,8 @@ const posts = (await Astro.glob('./blog/*.{md,mdx}')).sort(
|
|||
</time>
|
||||
<a href={post.url}>{post.frontmatter.title}</a>
|
||||
</li>
|
||||
))}
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
</section>
|
||||
</main>
|
||||
|
|
|
@ -72,7 +72,8 @@ const additionalContributors = unique.length - recentContributors.length; // lis
|
|||
<!-- Thanks to @5t3ph for https://smolcss.dev/#smol-avatar-list! -->
|
||||
<div class="contributors">
|
||||
<ul class="avatar-list" style={`--avatar-count: ${recentContributors.length}`}>
|
||||
{recentContributors.map((item) => (
|
||||
{
|
||||
recentContributors.map((item) => (
|
||||
<li>
|
||||
<a href={`https://github.com/${item.login}`}>
|
||||
<img
|
||||
|
@ -84,15 +85,18 @@ const additionalContributors = unique.length - recentContributors.length; // lis
|
|||
/>
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
{additionalContributors > 0 && (
|
||||
{
|
||||
additionalContributors > 0 && (
|
||||
<span>
|
||||
<a href={commitsURL}>{`and ${additionalContributors} additional contributor${
|
||||
additionalContributors > 1 ? 's' : ''
|
||||
}.`}</a>
|
||||
</span>
|
||||
)}
|
||||
)
|
||||
}
|
||||
{unique.length === 0 && <a href={commitsURL}>Contributors</a>}
|
||||
</div>
|
||||
|
||||
|
|
|
@ -21,9 +21,7 @@ import '../styles/index.css';
|
|||
/>
|
||||
|
||||
<!-- Scrollable a11y code helper -->
|
||||
<script src="/make-scrollable-code-focusable.js" is:inline>
|
||||
|
||||
</script>
|
||||
<script src="/make-scrollable-code-focusable.js" is:inline></script>
|
||||
|
||||
<!-- This is intentionally inlined to avoid FOUC -->
|
||||
<script is:inline>
|
||||
|
|
|
@ -16,7 +16,8 @@ const sidebar = SIDEBAR[langCode];
|
|||
|
||||
<nav aria-labelledby="grid-left">
|
||||
<ul class="nav-groups">
|
||||
{Object.entries(sidebar).map(([header, children]) => (
|
||||
{
|
||||
Object.entries(sidebar).map(([header, children]) => (
|
||||
<li>
|
||||
<div class="nav-group">
|
||||
<h2>{header}</h2>
|
||||
|
@ -34,7 +35,8 @@ const sidebar = SIDEBAR[langCode];
|
|||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
|
|
|
@ -12,7 +12,8 @@ const showMoreSection = CONFIG.COMMUNITY_INVITE_URL;
|
|||
|
||||
{showMoreSection && <h2 class="heading">More</h2>}
|
||||
<ul>
|
||||
{editHref && (
|
||||
{
|
||||
editHref && (
|
||||
<li class={`heading-link depth-2`}>
|
||||
<a class="edit-on-github" href={editHref} target="_blank">
|
||||
<svg
|
||||
|
@ -35,8 +36,10 @@ const showMoreSection = CONFIG.COMMUNITY_INVITE_URL;
|
|||
<span>Edit this page</span>
|
||||
</a>
|
||||
</li>
|
||||
)}
|
||||
{CONFIG.COMMUNITY_INVITE_URL && (
|
||||
)
|
||||
}
|
||||
{
|
||||
CONFIG.COMMUNITY_INVITE_URL && (
|
||||
<li class={`heading-link depth-2`}>
|
||||
<a href={CONFIG.COMMUNITY_INVITE_URL} target="_blank">
|
||||
<svg
|
||||
|
@ -59,7 +62,8 @@ const showMoreSection = CONFIG.COMMUNITY_INVITE_URL;
|
|||
<span>Join our community</span>
|
||||
</a>
|
||||
</li>
|
||||
)}
|
||||
)
|
||||
}
|
||||
</ul>
|
||||
<div style="margin: 2rem 0; text-align: center;">
|
||||
<ThemeToggleButton client:visible />
|
||||
|
|
|
@ -20,10 +20,12 @@ import { MyCounter } from '../components/my-counter.js';
|
|||
<MyCounter client:load />
|
||||
<Lorem />
|
||||
|
||||
{/**
|
||||
{
|
||||
/**
|
||||
* Our VS Code extension does not currently properly typecheck attributes on Lit components
|
||||
* As such, the following code will result in a TypeScript error inside the editor, nonetheless, it works in Astro!
|
||||
* @ts-expect-error */}
|
||||
* @ts-expect-error */
|
||||
}
|
||||
<CalcAdd num={0} />
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -16,7 +16,7 @@ const { comment } = Astro.props;
|
|||
<a href={`/users/${comment.user}`}>{comment.user}</a>{' '}
|
||||
{comment.time_ago} ago
|
||||
</div>
|
||||
<div class="text" set:html={comment.content}></div>
|
||||
<div class="text" set:html={comment.content} />
|
||||
<Show when={comment.comments.length}>
|
||||
<Toggle open>
|
||||
<For each={comment.comments}>{(comment: IComment) => <Astro.self comment={comment} />}</For>
|
||||
|
|
|
@ -8,13 +8,15 @@ export interface Props<T> {
|
|||
const { each } = Astro.props;
|
||||
---
|
||||
|
||||
{(async function* () {
|
||||
{
|
||||
(async function* () {
|
||||
for await (const value of each) {
|
||||
let html = await Astro.slots.render('default', [value]);
|
||||
yield <Fragment set:html={html} />;
|
||||
yield '\n';
|
||||
}
|
||||
})()}
|
||||
})()
|
||||
}
|
||||
|
||||
<Show when={!each.length}>
|
||||
<slot name="fallback" />
|
||||
|
|
|
@ -15,11 +15,13 @@ const links: Link[] = [
|
|||
|
||||
<header>
|
||||
<nav aria-label="Main menu">
|
||||
{links.map(({ href, text }) => (
|
||||
{
|
||||
links.map(({ href, text }) => (
|
||||
<a href={href} aria-current={href === Astro.url.pathname ? 'page' : undefined}>
|
||||
<strong>{text}</strong>
|
||||
</a>
|
||||
))}
|
||||
))
|
||||
}
|
||||
<a class="github" href="http://github.com/withastro/astro" target="_blank" rel="noreferrer">
|
||||
Built with Astro
|
||||
</a>
|
||||
|
|
|
@ -25,7 +25,7 @@ const user = (await fetchAPI(`user/${id}`)) as IUser;
|
|||
{user.karma}
|
||||
</li>
|
||||
<Show when={user.about}>
|
||||
<li set:html={user.about} class="about"></li>{' '}
|
||||
<li set:html={user.about} class="about" />{' '}
|
||||
</Show>
|
||||
</ul>
|
||||
<p>
|
||||
|
|
|
@ -17,11 +17,13 @@ const { frontmatter, url } = Astro.props.project;
|
|||
<p class="desc">{frontmatter.description}</p>
|
||||
<div class="tags">
|
||||
Tagged:
|
||||
{frontmatter.tags.map((t) => (
|
||||
{
|
||||
frontmatter.tags.map((t) => (
|
||||
<div class="tag" data-tag={t}>
|
||||
{t}
|
||||
</div>
|
||||
))}
|
||||
))
|
||||
}
|
||||
</div>
|
||||
<a class="link" href={url}>
|
||||
<span class="linkInner">View</span>
|
||||
|
|
|
@ -52,7 +52,8 @@ const { products } = Astro.props;
|
|||
</style>
|
||||
<slot name="title" />
|
||||
<ul>
|
||||
{products.map((product) => (
|
||||
{
|
||||
products.map((product) => (
|
||||
<li class="product">
|
||||
<a href={`/products/${product.id}`}>
|
||||
<figure>
|
||||
|
@ -64,5 +65,6 @@ const { products } = Astro.props;
|
|||
</figure>
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
|
|
|
@ -13,9 +13,11 @@ const last = words.length - 1;
|
|||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
{words.map((word, i) => (
|
||||
{
|
||||
words.map((word, i) => (
|
||||
<Fragment>
|
||||
<span>{word}</span>
|
||||
{i !== last && <Fragment> </Fragment>}
|
||||
</Fragment>
|
||||
))}
|
||||
))
|
||||
}
|
||||
|
|
|
@ -36,12 +36,14 @@ const cart = await getCart(Astro.request);
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{cart.items.map((item) => (
|
||||
{
|
||||
cart.items.map((item) => (
|
||||
<tr>
|
||||
<td>{item.name}</td>
|
||||
<td>{item.count}</td>
|
||||
</tr>
|
||||
))}
|
||||
))
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</Container>
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
|
||||
<body>
|
||||
<h1>Welcome to <a href="https://astro.build/">Astro</a></h1>
|
||||
<script src="/src/index.ts">
|
||||
|
||||
</script>
|
||||
<script src="/src/index.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -501,7 +501,7 @@
|
|||
This expands the abilities of `set:html` to ultimate service this use-case:
|
||||
|
||||
```astro
|
||||
<div set:html={fetch('/legacy-post.html')}></div>
|
||||
<div set:html={fetch('/legacy-post.html')} />
|
||||
```
|
||||
|
||||
This means you can take a legacy app that has been statically generated to HTML and directly consume that HTML within your templates. As is always the case with `set:html`, this should only be used on trusted content.
|
||||
|
@ -514,8 +514,7 @@
|
|||
set:html={new Response('<span>Hello world</span>', {
|
||||
headers: { 'content-type': 'text/html' },
|
||||
})}
|
||||
>
|
||||
</div>
|
||||
/>
|
||||
```
|
||||
- `ReadableStream`s:
|
||||
```astro
|
||||
|
@ -526,8 +525,7 @@
|
|||
controller.close();
|
||||
},
|
||||
})}
|
||||
>
|
||||
</div>
|
||||
/>
|
||||
```
|
||||
- `AsyncIterable`s:
|
||||
```astro
|
||||
|
@ -537,8 +535,7 @@
|
|||
yield `<li>${num}</li>`;
|
||||
}
|
||||
})()}
|
||||
>
|
||||
</div>
|
||||
/>
|
||||
```
|
||||
- `Iterable`s (non-async):
|
||||
```astro
|
||||
|
@ -548,8 +545,7 @@
|
|||
yield `<li>${num}</li>`;
|
||||
}
|
||||
})()}
|
||||
>
|
||||
</div>
|
||||
/>
|
||||
```
|
||||
|
||||
### Patch Changes
|
||||
|
|
Loading…
Reference in a new issue