Compare commits

...

4 commits

Author SHA1 Message Date
孙振飞
8f65b9dbd5
Merge pull request #33 from ClovertaTheTrilobita/dev
Some checks failed
Sync and Deploy Astro Blog / sync-blog-content (push) Has been cancelled
Sync and Deploy Astro Blog / manual-deploy (push) Has been cancelled
Sync and Deploy Astro Blog / build-and-deploy (push) Has been cancelled
update github actions node version
2026-07-28 13:22:55 +08:00
a4d28d7ad8 update github actions node version 2026-07-28 13:21:40 +08:00
孙振飞
d9df46084a
Merge pull request #31 from ClovertaTheTrilobita/dev
update friends link style
2026-07-28 13:10:33 +08:00
8f42e7fa7b update friends link style 2026-07-28 13:08:49 +08:00
2 changed files with 74 additions and 13 deletions

View file

@ -20,7 +20,7 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v5 uses: actions/checkout@v7
with: with:
fetch-depth: 0 fetch-depth: 0
@ -58,12 +58,12 @@ jobs:
steps: steps:
- name: Checkout blog-content branch - name: Checkout blog-content branch
uses: actions/checkout@v5 uses: actions/checkout@v7
with: with:
ref: blog-content ref: blog-content
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v4 uses: actions/setup-node@v7
with: with:
node-version: 24 node-version: 24
cache: npm cache: npm
@ -120,12 +120,12 @@ jobs:
steps: steps:
- name: Checkout blog-content branch - name: Checkout blog-content branch
uses: actions/checkout@v4 uses: actions/checkout@v7
with: with:
ref: blog-content ref: blog-content
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v4 uses: actions/setup-node@v7
with: with:
node-version: 24 node-version: 24
cache: npm cache: npm

View file

@ -5,18 +5,19 @@ import { getLangFromUrl } from "@/i18n";
const lang = getLangFromUrl(Astro.url); const lang = getLangFromUrl(Astro.url);
const links = await getCollection("friends"); const links = await getCollection("friends");
// const { links = [] } = Astro.props;
--- ---
<div class="friendly-link-list"> <div class="friendly-link-list">
{ {
links.map((link: any) => ( links.map((link: any) => (
<FriendlyLinkItem <div class="friendly-link-wrapper">
name={link.data.name} <FriendlyLinkItem
description={link.data.description} name={link.data.name}
avatar={link.data.avatar} description={link.data.description}
url={link.data.url} avatar={link.data.avatar}
/> url={link.data.url}
/>
</div>
)) ))
} }
</div> </div>
@ -25,15 +26,75 @@ const links = await getCollection("friends");
.friendly-link-list { .friendly-link-list {
max-width: 770px; max-width: 770px;
margin: 0 auto; margin: 0 auto;
display: grid; display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-columns: repeat(24, minmax(0, 1fr));
gap: 1rem; gap: 1rem;
align-items: start; align-items: start;
} }
.friendly-link-wrapper {
min-width: 0;
}
.friendly-link-wrapper :global(.friendly-link-card) {
width: 100%;
box-sizing: border-box;
}
@media (min-width: 721px) {
/*
* 连续波浪:
* 第 1 行5.5 : 6.5
* 第 2 行6 : 6
* 第 3 行6.5 : 5.5
* 第 4 行6 : 6
* 然后重复
*/
/* 5.5,即 11 / 24 */
.friendly-link-wrapper:nth-child(8n + 1),
.friendly-link-wrapper:nth-child(8n + 6) {
grid-column: span 11;
}
/* 6即 12 / 24 */
.friendly-link-wrapper:nth-child(8n + 3),
.friendly-link-wrapper:nth-child(8n + 4),
.friendly-link-wrapper:nth-child(8n + 7),
.friendly-link-wrapper:nth-child(8n + 8) {
grid-column: span 12;
}
/* 6.5,即 13 / 24 */
.friendly-link-wrapper:nth-child(8n + 2),
.friendly-link-wrapper:nth-child(8n + 5) {
grid-column: span 13;
}
}
@media (max-width: 720px) { @media (max-width: 720px) {
.friendly-link-list { .friendly-link-list {
grid-template-columns: 1fr; grid-template-columns: 1fr;
} }
.friendly-link-wrapper {
justify-self: left;
}
.friendly-link-wrapper:nth-child(4n + 1) {
width: 84%;
}
/* 第 2、4、6、8……张 */
.friendly-link-wrapper:nth-child(4n + 2),
.friendly-link-wrapper:nth-child(4n) {
width: 92%;
}
/* 第 3、7、11……张 */
.friendly-link-wrapper:nth-child(4n + 3) {
width: 100%;
}
} }
</style> </style>