feat(theme): 新增主题可配置项,优化代码逻辑和样式

-  在 `komari-theme.json` 中添加了新的配置选项
- 支持自定义标题栏、内容区、实例页面和通用UI元素
- 优化部分组件调用逻辑
- 优化页面样式
This commit is contained in:
Montia37
2025-08-15 19:27:55 +08:00
parent e74611b947
commit 1c1f739043
21 changed files with 922 additions and 766 deletions

26
src/config/hooks.ts Normal file
View File

@@ -0,0 +1,26 @@
import { useContext } from "react";
import type { ConfigOptions } from "./default";
import { ConfigContext } from "./ConfigContext";
/**
* 使用全局配置 Hook用于获取当前应用配置
* @returns 配置对象
*/
export function useAppConfig(): ConfigOptions {
return useContext(ConfigContext);
}
/**
* 使用特定配置项 Hook直接获取某个配置项的值
* @param key 配置项键名
* @returns 配置项的值
*/
export function useConfigItem<K extends keyof ConfigOptions>(
key: K
): ConfigOptions[K] {
const config = useContext(ConfigContext);
return config[key];
}
// 导出配置类型
export type { ConfigOptions } from "./default";