feat: update figma category card icons

This commit is contained in:
TerryM
2026-05-28 15:49:08 +08:00
parent 3ed3d00655
commit 28b0ef3f9a
18 changed files with 136 additions and 164 deletions

View File

@@ -1,5 +1,13 @@
import { describe, expect, it } from "vitest";
import { categoryCardLines } from "./categoryDisplay";
import { categoryCardLines, cleanCategoryDisplayName } from "./categoryDisplay";
describe("cleanCategoryDisplayName", () => {
it("removes parenthetical suffixes used as backend qualifiers", () => {
expect(cleanCategoryDisplayName("官方公告(繁中)")).toBe("官方公告");
expect(cleanCategoryDisplayName("Tutorials (EN)")).toBe("Tutorials");
expect(cleanCategoryDisplayName("补贴政策\r")).toBe("补贴政策");
});
});
describe("categoryCardLines", () => {
it("splits Chinese and ASCII parenthetical subtitles", () => {

View File

@@ -1,3 +1,10 @@
export function cleanCategoryDisplayName(name: string): string {
return name
.replace(/\s*[(][^()]*[)]\s*/g, " ")
.replace(/\s+/g, " ")
.trim();
}
/** Split display name into title + parenthetical subtitle (matches design cards). */
export function categoryCardLines(
name: string,