website
git clone https://git.pyrossh.dev/website
木 Personal website of pyrossh. Built with astrojs, shiki, vite.
4e14b53
— pyrossh
2026-07-04T14:55:30+05:30
refactor: migrate FileLayout icons to DynamicIcon
- src/layouts/FileLayout.astro +4 -16
src/layouts/FileLayout.astro
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
-
import
|
|
2
|
+
import DynamicIcon from "@/components/DynamicIcon.astro";
|
|
3
|
-
import { type CollectionEntry } from "astro:content";
|
|
4
|
-
import allIcons from "@iconify-json/vscode-icons/icons.json" assert { type: "json" };
|
|
5
3
|
import RepoLayout from "@/layouts/RepoLayout.astro";
|
|
6
4
|
import { resolveFileIcon, type FileNode } from "@/utils/files";
|
|
5
|
+
import type { RepoEntry } from "@/utils/repos";
|
|
7
6
|
|
|
8
7
|
type Props = {
|
|
9
|
-
repo:
|
|
8
|
+
repo: RepoEntry;
|
|
10
9
|
file: FileNode;
|
|
11
10
|
};
|
|
12
11
|
|
|
13
12
|
const { repo, file } = Astro.props;
|
|
14
13
|
const { pathname } = Astro.url;
|
|
15
14
|
const iconName = resolveFileIcon(file.name, file.ext);
|
|
16
|
-
const fileType = allIcons.icons[`file-type-${iconName}`]
|
|
17
|
-
? `file-type-${iconName}`
|
|
18
|
-
: "default-file";
|
|
19
15
|
---
|
|
20
16
|
|
|
21
17
|
<RepoLayout repo={repo}>
|
|
@@ -24,11 +20,7 @@ const fileType = allIcons.icons[`file-type-${iconName}`]
|
|
|
24
20
|
<div>
|
|
25
21
|
<hr />
|
|
26
22
|
<div class="title">
|
|
27
|
-
<Icon
|
|
28
|
-
name={`vscode-icons:${fileType}`}
|
|
29
|
-
size="24px"
|
|
30
|
-
|
|
23
|
+
<DynamicIcon name={`file-type-${iconName}`} size="24px" color="hsl(0deg 75% 75%)" />
|
|
31
|
-
/>
|
|
32
24
|
<h3>{file.name}</h3>
|
|
33
25
|
</div>
|
|
34
26
|
<hr />
|
|
@@ -115,8 +107,4 @@ const fileType = allIcons.icons[`file-type-${iconName}`]
|
|
|
115
107
|
font-weight: 500;
|
|
116
108
|
}
|
|
117
109
|
|
|
118
|
-
svg[data-icon] {
|
|
119
|
-
font-weight: 600;
|
|
120
|
-
margin-right: 4px;
|
|
121
|
-
}
|
|
122
110
|
</style>
|