feat(应用): 实现带可折叠侧边栏的仪表盘布局
添加从根路径到/app/dashboard的服务器端重定向 创建包含主内容容器的应用布局组件 实现带响应式侧边栏和顶栏的仪表盘页面 添加带平滑过渡效果的侧边栏切换功能 设置基础用户状态管理仓库 使用对等依赖标志更新package-lock.json中的依赖项 从锁定文件中移除冗余的picomatch条目 添加带路径解析导入的登录页面组件
This commit is contained in:
13
src/lib/widget/ThemePreview.svelte
Normal file
13
src/lib/widget/ThemePreview.svelte
Normal file
@@ -0,0 +1,13 @@
|
||||
<script lang="ts">
|
||||
/**
|
||||
* @type {string} themeId - 要预览的主题的英文 ID (e.g., 'light', 'dark')
|
||||
*/
|
||||
export let themeId: string;
|
||||
</script>
|
||||
|
||||
<div data-theme={themeId} class="bg-base-300 w-8 h-8 rounded-xl relative border border-accent-content/10">
|
||||
<span class="w-1.5 h-1.5 bg-success absolute top-2 left-2 rounded-full"> </span>
|
||||
<span class="w-1.5 h-1.5 bg-secondary absolute right-2 top-2 rounded-full"> </span>
|
||||
<span class="w-1.5 h-1.5 bg-warning absolute bottom-2 left-2 rounded-full"> </span>
|
||||
<span class="w-1.5 h-1.5 bg-error absolute bottom-2 right-2 rounded-full"> </span>
|
||||
</div>
|
||||
41
src/lib/widget/ThemeSelector.svelte
Normal file
41
src/lib/widget/ThemeSelector.svelte
Normal file
@@ -0,0 +1,41 @@
|
||||
<script lang="ts">
|
||||
import { themeStore } from '$lib/stores/themeStore.ts';
|
||||
import { DAISYUI_THEME_OPTIONS, type DaisyUIThemeID } from '$lib/types/theme.ts';
|
||||
import ThemePreview from '$lib/widget/ThemePreview.svelte';
|
||||
|
||||
// ... 逻辑保持不变 ...
|
||||
const handleThemeChange = (themeValue: DaisyUIThemeID) => {
|
||||
themeStore.set(themeValue);
|
||||
};
|
||||
</script>
|
||||
|
||||
<div class="dropdown dropdown-end">
|
||||
<div tabindex="0" role="button" class="rounded hover:bg-base-100 active:bg-base-200 p-2 overflow-hidden flex items-center gap-2">
|
||||
<ThemePreview themeId={$themeStore} />
|
||||
<svg width="12px" height="12px" class="mt-px text-base-content size-2 fill-current opacity-60 sm:inline-block" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2048 2048"><path d="M1799 349l242 241-1017 1017L7 590l242-241 775 775 775-775z"></path></svg>
|
||||
</div>
|
||||
|
||||
<ul class="dropdown-content shadow bg-base-200 border border-base-content/10 z-[1] rounded-box w-64 max-h-80 overflow-x-hidden overflow-y-auto flex flex-col ">
|
||||
|
||||
{#each DAISYUI_THEME_OPTIONS as theme (theme.value)}
|
||||
|
||||
<li class="text-base-content w-full ">
|
||||
<div
|
||||
role="button"
|
||||
tabindex="0"
|
||||
on:click={() => handleThemeChange(theme.value)}
|
||||
on:keydown={(e) => {
|
||||
if (e.key === 'Enter' || e.key === ' ') {
|
||||
e.preventDefault();
|
||||
handleThemeChange(theme.value);
|
||||
}
|
||||
}}
|
||||
class="gap-3 w-full flex hover:bg-base-300 active:bg-primary p-2 items-center {theme.value === $themeStore ? 'active' : ''}"
|
||||
>
|
||||
<ThemePreview themeId={theme.value} />
|
||||
<div class=" ">{theme.name}</div>
|
||||
</div>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
</div>
|
||||
Reference in New Issue
Block a user