Skip to content

Commit 084d4c1

Browse files
committed
feat(icons): replace inline SVGs with Icon component for improved maintainability
1 parent 5f346a3 commit 084d4c1

13 files changed

Lines changed: 69 additions & 70 deletions

File tree

Lines changed: 6 additions & 0 deletions
Loading
Lines changed: 9 additions & 0 deletions
Loading
Lines changed: 6 additions & 0 deletions
Loading
Lines changed: 9 additions & 0 deletions
Loading
Lines changed: 6 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

src/assets/icons/folder-open.svg

Lines changed: 3 additions & 0 deletions
Loading

src/assets/icons/refresh.svg

Lines changed: 1 addition & 0 deletions
Loading

src/components/Icon.svelte

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import pageOrientationSvg from '@/assets/icons/page-orientation.svg?raw';
77
import githubSvg from '@/assets/icons/github.svg?raw';
88
import xiaohongshuSvg from '@/assets/icons/xiaohongshu.svg?raw';
9+
import refreshSvg from '@/assets/icons/refresh.svg?raw';
10+
import folderOpenSvg from '@/assets/icons/folder-open.svg?raw';
911
1012
interface Props {
1113
name?: string;
@@ -25,7 +27,9 @@
2527
'check': successSvg,
2628
'page-orientation': pageOrientationSvg,
2729
'github': githubSvg,
28-
'xiaohongshu': xiaohongshuSvg
30+
'xiaohongshu': xiaohongshuSvg,
31+
'refresh': refreshSvg,
32+
'folder-open': folderOpenSvg
2933
};
3034
3135
const svgContent = $derived.by(() => {

src/components/Preview.svelte

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import { handleImageUpdate } from "@/lib/preview-engine/image-engine";
99
import PagedRenderer from "./renderers/PagedRenderer.svelte";
1010
import { docStore } from '@/stores/docStore.svelte'; // Import docStore
11+
import Icon from "@/components/Icon.svelte";
1112
1213
interface Props {
1314
mode?: "svg" | "image" | "paged";
@@ -199,16 +200,7 @@
199200
onclick={handleRefreshClick}
200201
title="Refresh Preview"
201202
>
202-
<svg
203-
xmlns="http://www.w3.org/2000/svg"
204-
width="20"
205-
height="20"
206-
viewBox="0 0 1024 1024"
207-
fill="currentColor"
208-
><path
209-
d="M896 198.4 896 198.4l0 179.2 0 0c0 19.2-6.4 32-19.2 44.8-12.8 12.8-32 19.2-44.8 19.2l0 0-179.2 0 0 0c-19.2 0-32-6.4-44.8-19.2-25.6-25.6-25.6-64 0-89.6C620.8 320 633.6 313.6 652.8 313.6l0 0 25.6 0C627.2 275.2 576 256 518.4 256 441.6 256 377.6 281.6 332.8 332.8l0 0c-25.6 25.6-64 25.6-89.6 0-25.6-25.6-25.6-64 0-89.6l0 0C313.6 172.8 409.6 128 518.4 128c96 0 185.6 38.4 249.6 96L768 198.4l0 0c0-19.2 6.4-32 19.2-44.8 25.6-25.6 64-25.6 89.6 0C889.6 160 896 179.2 896 198.4zM416 691.2c-12.8 12.8-32 19.2-44.8 19.2l0 0L352 710.4C396.8 748.8 448 768 505.6 768c70.4 0 134.4-25.6 179.2-76.8l0 0c25.6-25.6 64-25.6 89.6 0 25.6 25.6 25.6 64 0 89.6l0 0C710.4 851.2 614.4 896 505.6 896c-96 0-185.6-38.4-249.6-96l0 32 0 0c0 19.2-6.4 32-19.2 44.8-25.6 25.6-64 25.6-89.6 0C134.4 864 128 844.8 128 825.6l0 0 0-179.2 0 0c0-19.2 6.4-32 19.2-44.8C160 588.8 172.8 582.4 192 582.4l0 0 179.2 0 0 0c19.2 0 32 6.4 44.8 19.2C441.6 627.2 441.6 665.6 416 691.2z"
210-
></path></svg
211-
>
203+
<Icon name="refresh" width="20" height="20" />
212204
</button>
213205
{/if}
214206
</div>
@@ -514,21 +506,10 @@
514506
color: #1677ff;
515507
}
516508
517-
.refresh-fab.spinning svg {
509+
:global(.refresh-fab.spinning svg) {
518510
animation: spin 0.3s ease-out forwards;
519511
}
520512
521-
@keyframes spin {
522-
from {
523-
transform: rotate(0deg);
524-
}
525-
to {
526-
transform: rotate(360deg);
527-
}
528-
}
529-
.refresh-fab.spinning svg {
530-
animation: spin 0.3s ease-out forwards;
531-
}
532513
@keyframes spin {
533514
from {
534515
transform: rotate(0deg);

0 commit comments

Comments
 (0)