|
1 | 1 | ---
|
2 | 2 | import { Image } from "astro:assets";
|
3 |
| -import FriendsLayout from "../layouts/FriendsLayout.astro"; |
4 | 3 | import friends from "../../public/assets/friends.json";
|
| 4 | +import MainLayout from "../layouts/MainLayout.astro"; |
5 | 5 | friends.sort(() => Math.random() - 0.5);
|
6 | 6 | ---
|
7 | 7 |
|
8 |
| -<FriendsLayout> |
9 |
| - { |
10 |
| - friends.map(({ name, des, icon, url }) => ( |
11 |
| - <a class="main" href={url}> |
12 |
| - <div class="left"> |
13 |
| - <Image src={icon} alt={name + " avatar"} width="96" height="96" /> |
14 |
| - </div> |
15 |
| - <div class="right"> |
16 |
| - <p class="name">{name}</p> |
17 |
| - <p class="description">{des}</p> |
18 |
| - </div> |
19 |
| - </a> |
20 |
| - )) |
21 |
| - } |
22 |
| -</FriendsLayout> |
| 8 | +<MainLayout description="本页面供奉着我的朋友们(不是" keywords="friends,links"> |
| 9 | + <div id="cards"> |
| 10 | + { |
| 11 | + friends.map(({ name, des, icon, url }) => ( |
| 12 | + <a class="main" href={url}> |
| 13 | + <div class="left"> |
| 14 | + <Image src={icon} alt={name + " avatar"} width="96" height="96" /> |
| 15 | + </div> |
| 16 | + <div class="right"> |
| 17 | + <p class="name">{name}</p> |
| 18 | + <p class="description">{des}</p> |
| 19 | + </div> |
| 20 | + </a> |
| 21 | + )) |
| 22 | + } |
| 23 | + </div> |
| 24 | + |
| 25 | + <div id="info"> |
| 26 | + <p>前辈!和我交换友链吧!</p> |
| 27 | + <p> |
| 28 | + 提供你的 <strong>名字</strong>、<strong>描述</strong>、<strong |
| 29 | + >头像</strong |
| 30 | + >、<strong>地址</strong>, 或者按照如下格式发送到 |
| 31 | + < a href= "mailto:[email protected]" target= "_blank">这里!</ a> |
| 32 | + </p> |
| 33 | + <pre><code> |
| 34 | + "name": "田所浩二", |
| 35 | + "des": "逸一时误一世。", |
| 36 | + "icon": "https://icon.shimo/114514", |
| 37 | + "url": "https://tadokorokouji.homo" |
| 38 | +</code></pre> |
| 39 | + </div> |
| 40 | +</MainLayout> |
23 | 41 |
|
24 | 42 | <style>
|
| 43 | + #info { |
| 44 | + padding: 20px 50px; |
| 45 | + } |
| 46 | + #cards { |
| 47 | + display: grid; |
| 48 | + grid-template-columns: repeat(2, 300px); /* 每张卡片固定宽度 */ |
| 49 | + justify-content: center; /* 整体网格居中 */ |
| 50 | + gap: 20px; |
| 51 | + } |
| 52 | + @media (max-width: 600px) { |
| 53 | + #cards { |
| 54 | + grid-template-columns: 1fr; /* 在小屏幕上改为单列 */ |
| 55 | + width: 90vw; |
| 56 | + } |
| 57 | + } |
| 58 | + |
25 | 59 | .main {
|
26 | 60 | text-decoration: none; /* 去除下划线 */
|
27 | 61 | color: inherit; /* 继承父元素的颜色 */
|
|
0 commit comments