Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/routes/reference/default-theme/landing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Landing

# Landing

The landing page is configured using [Rrontmatter](../frontmatter):
The landing page is configured using [Frontmatter](../frontmatter):

```md
---
Expand Down
2 changes: 1 addition & 1 deletion src/default-theme/Layout.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
}

.sidenav {
min-width: 14rem;
min-width: 14.5rem;
height: calc(100dvh - var(--sb-header-height));
position: sticky;
top: var(--sb-header-height);
Expand Down
10 changes: 6 additions & 4 deletions src/default-theme/components/Article.module.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
.article {
margin: 2rem;
padding: 2rem;
display: flex;
height: 100%;
}

.content {
max-width: min(calc(100dvw - 2.5rem), 52rem);
flex: 1;
margin: 0 auto;
display: flex;
flex-direction: column;
}

.aside {
Expand Down Expand Up @@ -44,7 +47,7 @@
font-size: 0.9em;
margin: 4rem 0 1rem;
display: flex;
justify-content: space-between;
flex-direction: row;
white-space: nowrap;
flex-wrap: wrap;
gap: 0.5rem;
Expand All @@ -54,9 +57,8 @@
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-column-gap: 1rem;
margin: 2rem 0;
font-size: 0.9em;
padding: 2rem 0 0;
padding: 1.5rem 0;
border-top: 1px solid
color-mix(in hsl, var(--sb-decoration-color) 15%, transparent);
}
Expand Down
34 changes: 26 additions & 8 deletions src/default-theme/components/Article.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ export default function Article(props: ParentProps) {
const customLink = (r?: RelativePageConfig) =>
typeof r === "object" ? r.link : undefined;

const info = () => {
const editLink = pageData()?.editLink;
const lastUpdated = frontmatter()?.lastUpdated;

if (editLink === undefined && lastUpdated === undefined) return;
return { editLink, lastUpdated };
};

return (
<>
<WindowEventListener onClick={onClick} />
Expand All @@ -99,15 +107,25 @@ export default function Article(props: ParentProps) {

{props.children}

<div class={styles.info}>
<Show when={frontmatter()?.lastUpdated} fallback={<div />}>
<LastUpdated />
</Show>
<div style={{ flex: 1 }} />

<Show when={info()}>
{(info) => (
<div class={styles.info}>
<Show when={info()?.lastUpdated}>
<LastUpdated />
</Show>

<Show when={pageData()?.editLink && frontmatter()?.editLink}>
<Link href={pageData()?.editLink}>Edit this page on GitHub</Link>
</Show>
</div>
<div style={{ flex: 1 }} />

<Show when={info().editLink}>
{(link) => (
<Link href={link()}>Edit this page on GitHub</Link>
)}
</Show>
</div>
)}
</Show>

<Show when={hasPrev() || hasNext()}>
<nav class={styles.related}>
Expand Down
1 change: 0 additions & 1 deletion src/default-theme/components/Footer.module.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.footer {
margin: 2rem 0;
padding: 2rem 0;
border-top: 1px solid
color-mix(in hsl, var(--sb-decoration-color) 15%, transparent);
Expand Down
1 change: 1 addition & 0 deletions src/default-theme/components/LastUpdated.module.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.last-updated {
margin-right: auto;
color: color-mix(in hsl, var(--sb-text-color) 72.5%, transparent);
}