Skip to content

Commit 0b560c3

Browse files
Add pagination override (footer basically)
1 parent f3fafd2 commit 0b560c3

File tree

4 files changed

+121
-1
lines changed

4 files changed

+121
-1
lines changed

web/astro.config.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ export default defineConfig({
1414
light: './src/assets/logo-black.png',
1515
dark: './src/assets/logo-white.png',
1616
},
17+
components: {
18+
// Override some default components
19+
Pagination: './src/overrides/Pagination.astro',
20+
},
1721
sidebar: [
1822
{
1923
label: 'Start here',

web/src/components/IconLinkCard.astro

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
// Source: https://github.com/withastro/starlight/blob/a3183597b740c19f95757ecd81fb8c99f87e2ca8/packages/starlight/user-components/LinkCard.astro
3+
// MIT License, Copyright (c) 2023 Astro contributors
4+
import type { HTMLAttributes } from 'astro/types';
5+
import { Icon } from '@astrojs/starlight/components';
6+
7+
type IconProps = Parameters<typeof Icon>[0];
8+
type StarlightIcon = IconProps['name'];
9+
10+
interface Props extends Omit<HTMLAttributes<'a'>, 'title'> {
11+
title: string;
12+
description?: string;
13+
icon?: StarlightIcon;
14+
}
15+
16+
const { title, description, icon, target = Astro.props.target || '_blank', ...attributes } = Astro.props;
17+
---
18+
19+
<div class="sl-link-card">
20+
<span class="sl-flex stack">
21+
<div class="inline-flex">
22+
{icon && <Icon name={icon} size="1.333em" class="icon" />}
23+
<a {...attributes}>
24+
<span class="title" set:html={title} />
25+
</a>
26+
</div>
27+
{description && <span class="description" set:html={description} />}
28+
</span>
29+
<Icon name="right-arrow" size="1.333em" class="icon rtl:flip" />
30+
</div>
31+
32+
<style>
33+
.sl-link-card {
34+
display: grid;
35+
grid-template-columns: 1fr auto;
36+
gap: 0.5rem;
37+
border: 1px solid var(--sl-color-gray-5);
38+
border-radius: 0.5rem;
39+
padding: 1rem;
40+
box-shadow: var(--sl-shadow-sm);
41+
position: relative;
42+
}
43+
44+
a {
45+
text-decoration: none;
46+
line-height: var(--sl-line-height-headings);
47+
}
48+
49+
/* a11y fix for https://github.com/withastro/starlight/issues/487 */
50+
a::before {
51+
content: '';
52+
position: absolute;
53+
inset: 0;
54+
}
55+
56+
.stack {
57+
flex-direction: column;
58+
gap: 0.5rem;
59+
}
60+
61+
.inline-flex {
62+
display: inline-flex;
63+
gap: 1rem;
64+
}
65+
66+
.title {
67+
color: var(--sl-color-white);
68+
font-weight: 600;
69+
font-size: var(--sl-text-lg);
70+
}
71+
72+
.description {
73+
color: var(--sl-color-gray-3);
74+
line-height: 1.5;
75+
}
76+
77+
.icon {
78+
color: var(--sl-color-gray-3);
79+
min-width: 1em;
80+
}
81+
82+
/* Hover state */
83+
.sl-link-card:hover {
84+
background: var(--sl-color-gray-7, var(--sl-color-gray-6));
85+
border-color: var(--sl-color-gray-2);
86+
}
87+
88+
.sl-link-card:hover .icon {
89+
color: var(--sl-color-white);
90+
}
91+
</style>

web/src/overrides/Pagination.astro

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
import { CardGrid } from '@astrojs/starlight/components';
3+
import IconLinkCard from '@src/components/IconLinkCard.astro';
4+
---
5+
6+
<CardGrid>
7+
<IconLinkCard
8+
icon="discord"
9+
title="Discord"
10+
description="Ask questions and chat live with the community."
11+
href="https://discord.com/invite/mtasa" />
12+
13+
<IconLinkCard
14+
icon="gitter"
15+
title="Forum"
16+
description="Engage with the community in the old-fashioned way."
17+
href="https://forum.multitheftauto.com/" />
18+
</CardGrid>

web/tsconfig.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
{
22
"extends": "astro/tsconfigs/strict",
33
"include": [".astro/types.d.ts", "**/*"],
4-
"exclude": ["dist"]
4+
"exclude": ["dist"],
5+
"compilerOptions": {
6+
"baseUrl": "src",
7+
"strictNullChecks": true,
8+
"paths": {
9+
"@src/*": ["*"],
10+
}
11+
}
512
}

0 commit comments

Comments
 (0)