mirror of
https://github.com/afoim/fuwari.git
synced 2026-01-31 00:53:19 +08:00
feat(图标): 添加本地SVG图标支持并更新相关配置
- 在astro配置中添加iconDir指定本地图标目录 - 移除@iconify-json/simple-icons生产依赖,改为开发依赖 - 添加多个本地SVG图标文件(creative-commons, qq, telegram等) - 更新配置文件使用本地图标替代Font Awesome图标 - 在Profile组件中添加文章数和字数统计功能
This commit is contained in:
@@ -68,6 +68,7 @@ export default defineConfig({
|
||||
"material-symbols-light": ["*"],
|
||||
"material-symbols": ["*"],
|
||||
},
|
||||
iconDir: "public/icons", // Add this line to specify the directory for local SVG icons
|
||||
}),
|
||||
svelte(),
|
||||
sitemap(),
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
"@iconify-json/fa6-regular": "^1.2.3",
|
||||
"@iconify-json/fa6-solid": "^1.2.3",
|
||||
"@iconify-json/material-symbols": "^1.2.20",
|
||||
"@iconify-json/simple-icons": "^1.2.42",
|
||||
"@iconify/svelte": "^4.2.0",
|
||||
"@swup/astro": "^1.6.0",
|
||||
"@tailwindcss/typography": "^0.5.16",
|
||||
@@ -71,6 +70,7 @@
|
||||
"@astrojs/ts-plugin": "^1.10.4",
|
||||
"@biomejs/biome": "1.9.4",
|
||||
"@iconify-json/material-symbols-light": "^1.2.49",
|
||||
"@iconify-json/simple-icons": "^1.2.42",
|
||||
"@rollup/plugin-yaml": "^4.1.2",
|
||||
"@types/markdown-it": "^14.1.2",
|
||||
"@types/mdast": "^4.0.4",
|
||||
|
||||
8
pnpm-lock.yaml
generated
8
pnpm-lock.yaml
generated
@@ -61,9 +61,6 @@ importers:
|
||||
'@iconify-json/material-symbols':
|
||||
specifier: ^1.2.20
|
||||
version: 1.2.20
|
||||
'@iconify-json/simple-icons':
|
||||
specifier: ^1.2.42
|
||||
version: 1.2.42
|
||||
'@iconify/svelte':
|
||||
specifier: ^4.2.0
|
||||
version: 4.2.0(svelte@5.28.2)
|
||||
@@ -173,6 +170,9 @@ importers:
|
||||
'@iconify-json/material-symbols-light':
|
||||
specifier: ^1.2.49
|
||||
version: 1.2.49
|
||||
'@iconify-json/simple-icons':
|
||||
specifier: ^1.2.42
|
||||
version: 1.2.42
|
||||
'@rollup/plugin-yaml':
|
||||
specifier: ^4.1.2
|
||||
version: 4.1.2(rollup@2.79.2)
|
||||
@@ -8984,7 +8984,7 @@ snapshots:
|
||||
|
||||
lightningcss@1.29.3:
|
||||
dependencies:
|
||||
detect-libc: 2.0.4
|
||||
detect-libc: 2.1.2
|
||||
optionalDependencies:
|
||||
lightningcss-darwin-arm64: 1.29.3
|
||||
lightningcss-darwin-x64: 1.29.3
|
||||
|
||||
1
public/icons/bilibili.svg
Normal file
1
public/icons/bilibili.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 512 512"><!-- Icon from Font Awesome 6 Brands by Dave Gandy - https://creativecommons.org/licenses/by/4.0/ --><path fill="currentColor" d="M488.6 104.1c16.7 18.1 24.4 39.7 23.3 65.7v202.4c-.4 26.4-9.2 48.1-26.5 65.1c-17.2 17-39.1 25.9-65.5 26.7H92.02c-26.45-.8-48.21-9.8-65.28-27.2C9.682 419.4.767 396.5 0 368.2V169.8c.767-26 9.682-47.6 26.74-65.7C43.81 87.75 65.57 78.77 92.02 78h29.38L96.05 52.19c-5.75-5.73-8.63-13-8.63-21.79c0-8.8 2.88-16.06 8.63-21.797C101.8 2.868 109.1 0 117.9 0q13.2 0 21.9 8.603L213.1 78h88l74.5-69.397C381.7 2.868 389.2 0 398 0q13.2 0 21.9 8.603c5.7 5.737 8.6 12.997 8.6 21.797c0 8.79-2.9 16.06-8.6 21.79L394.6 78h29.3c26.4.77 48 9.75 64.7 26.1m-38.8 69.7c-.4-9.6-3.7-17.4-10.7-23.5c-5.2-6.1-14-9.4-22.7-9.8H96.05c-9.59.4-17.45 3.7-23.58 9.8c-6.14 6.1-9.4 13.9-9.78 23.5v194.4c0 9.2 3.26 17 9.78 23.5s14.38 9.8 23.58 9.8H416.4c9.2 0 17-3.3 23.3-9.8s9.7-14.3 10.1-23.5zm-264.3 42.7c6.3 6.3 9.7 14.1 10.1 23.2V273c-.4 9.2-3.7 16.9-9.8 23.2c-6.2 6.3-14 9.5-23.6 9.5s-17.5-3.2-23.6-9.5s-9.4-14-9.8-23.2v-33.3c.4-9.1 3.8-16.9 10.1-23.2s13.2-9.6 23.3-10c9.2.4 17 3.7 23.3 10m191.5 0c6.3 6.3 9.7 14.1 10.1 23.2V273c-.4 9.2-3.7 16.9-9.8 23.2s-14 9.5-23.6 9.5s-17.4-3.2-23.6-9.5c-7-6.3-9.4-14-9.7-23.2v-33.3c.3-9.1 3.7-16.9 10-23.2s14.1-9.6 23.3-10c9.2.4 17 3.7 23.3 10"/></svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
1
public/icons/creative-commons.svg
Normal file
1
public/icons/creative-commons.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="31" height="32" viewBox="0 0 496 512"><!-- Icon from Font Awesome 6 Brands by Dave Gandy - https://creativecommons.org/licenses/by/4.0/ --><path fill="currentColor" d="m245.83 214.87l-33.22 17.28c-9.43-19.58-25.24-19.93-27.46-19.93c-22.13 0-33.22 14.61-33.22 43.84c0 23.57 9.21 43.84 33.22 43.84c14.47 0 24.65-7.09 30.57-21.26l30.55 15.5c-6.17 11.51-25.69 38.98-65.1 38.98c-22.6 0-73.96-10.32-73.96-77.05c0-58.69 43-77.06 72.63-77.06c30.72-.01 52.7 11.95 65.99 35.86m143.05 0l-32.78 17.28c-9.5-19.77-25.72-19.93-27.9-19.93c-22.14 0-33.22 14.61-33.22 43.84c0 23.55 9.23 43.84 33.22 43.84c14.45 0 24.65-7.09 30.54-21.26l31 15.5c-2.1 3.75-21.39 38.98-65.09 38.98c-22.69 0-73.96-9.87-73.96-77.05c0-58.67 42.97-77.06 72.63-77.06c30.71-.01 52.58 11.95 65.56 35.86M247.56 8.05C104.74 8.05 0 123.11 0 256.05c0 138.49 113.6 248 247.56 248c129.93 0 248.44-100.87 248.44-248c0-137.87-106.62-248-248.44-248m.87 450.81c-112.54 0-203.7-93.04-203.7-202.81c0-105.42 85.43-203.27 203.72-203.27c112.53 0 202.82 89.46 202.82 203.26c-.01 121.69-99.68 202.82-202.84 202.82"/></svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
1
public/icons/folo.svg
Normal file
1
public/icons/folo.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M5.382 0h13.236A5.37 5.37 0 0 1 24 5.383v13.235A5.37 5.37 0 0 1 18.618 24H5.382A5.37 5.37 0 0 1 0 18.618V5.383A5.37 5.37 0 0 1 5.382.001Zm7.887 17.31a1.813 1.813 0 1 0-3.626.002a1.813 1.813 0 0 0 3.626-.002m-.535-6.527H7.213a1.813 1.813 0 1 0 0 3.624h5.521a1.813 1.813 0 1 0 0-3.624m4.417-4.712H8.87a1.813 1.813 0 1 0 0 3.625h8.283a1.813 1.813 0 1 0 0-3.624z"/></svg>
|
||||
|
After Width: | Height: | Size: 479 B |
1
public/icons/github.svg
Normal file
1
public/icons/github.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="31" height="32" viewBox="0 0 496 512"><!-- Icon from Font Awesome 6 Brands by Dave Gandy - https://creativecommons.org/licenses/by/4.0/ --><path fill="currentColor" d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6c-3.3.3-5.6-1.3-5.6-3.6c0-2 2.3-3.6 5.2-3.6c3-.3 5.6 1.3 5.6 3.6m-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9c2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3m44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9c.3 2 2.9 3.3 5.9 2.6c2.9-.7 4.9-2.6 4.6-4.6c-.3-1.9-3-3.2-5.9-2.9M244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2c12.8 2.3 17.3-5.6 17.3-12.1c0-6.2-.3-40.4-.3-61.4c0 0-70 15-84.7-29.8c0 0-11.4-29.1-27.8-36.6c0 0-22.9-15.7 1.6-15.4c0 0 24.9 2 38.6 25.8c21.9 38.6 58.6 27.5 72.9 20.9c2.3-16 8.8-27.1 16-33.7c-55.9-6.2-112.3-14.3-112.3-110.5c0-27.5 7.6-41.3 23.6-58.9c-2.6-6.5-11.1-33.3 2.6-67.9c20.9-6.5 69 27 69 27c20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27c13.7 34.7 5.2 61.4 2.6 67.9c16 17.7 25.8 31.5 25.8 58.9c0 96.5-58.9 104.2-114.8 110.5c9.2 7.9 17 22.9 17 46.4c0 33.7-.3 75.4-.3 83.6c0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252C496 113.3 383.5 8 244.8 8M97.2 352.9c-1.3 1-1 3.3.7 5.2c1.6 1.6 3.9 2.3 5.2 1c1.3-1 1-3.3-.7-5.2c-1.6-1.6-3.9-2.3-5.2-1m-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9c1.6 1 3.6.7 4.3-.7c.7-1.3-.3-2.9-2.3-3.9c-2-.6-3.6-.3-4.3.7m32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2c2.3 2.3 5.2 2.6 6.5 1c1.3-1.3.7-4.3-1.3-6.2c-2.2-2.3-5.2-2.6-6.5-1m-11.4-14.7c-1.6 1-1.6 3.6 0 5.9s4.3 3.3 5.6 2.3c1.6-1.3 1.6-3.9 0-6.2c-1.4-2.3-4-3.3-5.6-2"/></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
1
public/icons/qq.svg
Normal file
1
public/icons/qq.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="32" viewBox="0 0 448 512"><!-- Icon from Font Awesome 6 Brands by Dave Gandy - https://creativecommons.org/licenses/by/4.0/ --><path fill="currentColor" d="M433.754 420.445c-11.526 1.393-44.86-52.741-44.86-52.741c0 31.345-16.136 72.247-51.051 101.786c16.842 5.192 54.843 19.167 45.803 34.421c-7.316 12.343-125.51 7.881-159.632 4.037c-34.122 3.844-152.316 8.306-159.632-4.037c-9.045-15.25 28.918-29.214 45.783-34.415c-34.92-29.539-51.059-70.445-51.059-101.792c0 0-33.334 54.134-44.859 52.741c-5.37-.65-12.424-29.644 9.347-99.704c10.261-33.024 21.995-60.478 40.144-105.779C60.683 98.063 108.982.006 224 0c113.737.006 163.156 96.133 160.264 214.963c18.118 45.223 29.912 72.85 40.144 105.778c21.768 70.06 14.716 99.053 9.346 99.704"/></svg>
|
||||
|
After Width: | Height: | Size: 795 B |
1
public/icons/telegram.svg
Normal file
1
public/icons/telegram.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="31" height="32" viewBox="0 0 496 512"><!-- Icon from Font Awesome 6 Brands by Dave Gandy - https://creativecommons.org/licenses/by/4.0/ --><path fill="currentColor" d="M248 8C111.033 8 0 119.033 0 256s111.033 248 248 248s248-111.033 248-248S384.967 8 248 8m114.952 168.66c-3.732 39.215-19.881 134.378-28.1 178.3c-3.476 18.584-10.322 24.816-16.948 25.425c-14.4 1.326-25.338-9.517-39.287-18.661c-21.827-14.308-34.158-23.215-55.346-37.177c-24.485-16.135-8.612-25 5.342-39.5c3.652-3.793 67.107-61.51 68.335-66.746c.153-.655.3-3.1-1.154-4.384s-3.59-.849-5.135-.5q-3.283.746-104.608 69.142q-14.845 10.194-26.894 9.934c-8.855-.191-25.888-5.006-38.551-9.123c-15.531-5.048-27.875-7.717-26.8-16.291q.84-6.7 18.45-13.7q108.446-47.248 144.628-62.3c68.872-28.647 83.183-33.623 92.511-33.789c2.052-.034 6.639.474 9.61 2.885a10.45 10.45 0 0 1 3.53 6.716a43.8 43.8 0 0 1 .417 9.769"/></svg>
|
||||
|
After Width: | Height: | Size: 921 B |
@@ -54,7 +54,7 @@ const postUrl = decodeURIComponent(Astro.url.toString());
|
||||
<a href={licenseConf.url} target="_blank" class="link text-[var(--primary)] line-clamp-2">{licenseConf.name}</a>
|
||||
</div>
|
||||
</div>
|
||||
<Icon name="fa6-brands:creative-commons" class="transition text-[15rem] absolute pointer-events-none right-6 top-1/2 -translate-y-1/2 text-black/5 dark:text-white/5"></Icon>
|
||||
<Icon name="creative-commons" class="transition text-[15rem] absolute pointer-events-none right-6 top-1/2 -translate-y-1/2 text-black/5 dark:text-white/5"></Icon>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,19 @@
|
||||
---
|
||||
import { Icon } from "astro-icon/components";
|
||||
import { profileConfig, siteConfig, umamiConfig } from "../../config";
|
||||
import { getSortedPosts } from "@utils/content-utils";
|
||||
|
||||
const config = profileConfig;
|
||||
const posts = await getSortedPosts();
|
||||
const totalPosts = posts.length;
|
||||
let totalWords = 0;
|
||||
for (const post of posts) {
|
||||
const { remarkPluginFrontmatter } = await post.render();
|
||||
if (remarkPluginFrontmatter && remarkPluginFrontmatter.words) {
|
||||
totalWords += remarkPluginFrontmatter.words;
|
||||
}
|
||||
}
|
||||
|
||||
---
|
||||
<div class="card-base p-3 border border-black/10 dark:border-white/10">
|
||||
<div class="relative mx-auto mt-1 lg:mx-0 lg:mt-0 mb-3 max-w-[12rem] lg:max-w-none rounded-xl overflow-hidden" style={`--theme-hue: ${siteConfig.themeColor.hue}`}>
|
||||
@@ -25,6 +36,26 @@ const config = profileConfig;
|
||||
</a>}
|
||||
</div>
|
||||
|
||||
<!-- 全站文章与字数统计 -->
|
||||
<div class="grid grid-cols-2 mt-3 pt-3 border-t border-neutral-300 dark:border-neutral-700">
|
||||
<div class="text-center">
|
||||
<div class="text-xs text-neutral-500 mb-1 flex items-center justify-center gap-1">
|
||||
<Icon name="material-symbols:article-outline" class="text-base"></Icon>
|
||||
<span class="text-xs">文章数</span>
|
||||
</div>
|
||||
<div class="font-bold text-lg text-neutral-700 dark:text-neutral-300">{totalPosts}</div>
|
||||
</div>
|
||||
<div class="text-center border-l border-neutral-300 dark:border-neutral-700">
|
||||
<div class="text-xs text-neutral-500 mb-1 flex items-center justify-center gap-1">
|
||||
<Icon name="material-symbols:format-list-numbered" class="text-base"></Icon>
|
||||
<span class="text-xs">总字数</span>
|
||||
</div>
|
||||
<div class="font-bold text-lg text-neutral-700 dark:text-neutral-300">
|
||||
{(totalWords / 10000).toFixed(1)}w
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 全站访问量统计 -->
|
||||
<div class="grid grid-cols-2 mt-3 pt-3 border-t border-neutral-300 dark:border-neutral-700">
|
||||
<div class="text-center">
|
||||
|
||||
@@ -101,28 +101,28 @@ export const profileConfig: ProfileConfig = {
|
||||
links: [
|
||||
{
|
||||
name: "QQ",
|
||||
icon: "fa6-brands:qq",
|
||||
icon: "qq", // Local icon
|
||||
url: "https://qm.qq.com/q/FWqOHlwL2m",
|
||||
},
|
||||
{
|
||||
name: "Telegram",
|
||||
icon: "fa6-brands:telegram",
|
||||
icon: "telegram", // Local icon
|
||||
url: "https://t.me/+_07DERp7k1ljYTc1",
|
||||
},
|
||||
{
|
||||
name: "Bilibli",
|
||||
icon: "fa6-brands:bilibili",
|
||||
icon: "bilibili", // Local icon
|
||||
url: "https://space.bilibili.com/325903362",
|
||||
},
|
||||
{
|
||||
name: "Folo",
|
||||
icon: "fa6-brands:folo",
|
||||
url: "https://app.folo.is/share/feeds/236818461447222272",
|
||||
name: "GitHub",
|
||||
icon: "github", // Local icon
|
||||
url: "https://github.com/afoim",
|
||||
},
|
||||
{
|
||||
name: "GitHub",
|
||||
icon: "fa6-brands:github",
|
||||
url: "https://github.com/afoim",
|
||||
name: "Folo",
|
||||
icon: "folo", // Local icon
|
||||
url: "https://app.folo.is/share/feeds/236818461447222272",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user