Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
R
rrpgLink_FrontEnd
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kesaubeeire
rrpgLink_FrontEnd
Commits
8635c2dd
Commit
8635c2dd
authored
Oct 21, 2023
by
KesaubeEire
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 侧边栏主题选择.
parent
8b16b0e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
7 deletions
+44
-7
src/App.svelte
src/App.svelte
+44
-7
No files found.
src/App.svelte
View file @
8635c2dd
...
@@ -44,7 +44,7 @@
...
@@ -44,7 +44,7 @@
'winter'
'winter'
];
];
/**导航栏
注入
对象*/
/**导航栏
&侧边栏 -> 注入功能
对象*/
const injectText = [
const injectText = [
{
{
id: 'search',
id: 'search',
...
@@ -83,9 +83,10 @@
...
@@ -83,9 +83,10 @@
}
}
];
];
// -----------------------------
/**search input DOM元素*/
/**search input DOM元素*/
let searchInputDom;
let searchInputDom;
/**执行搜索
/**执行搜索
* @param event 事件对象
* @param event 事件对象
*/
*/
...
@@ -104,6 +105,13 @@
...
@@ -104,6 +105,13 @@
// }, 1000);
// }, 1000);
}
}
/**设定网站主题*/
function setTheme(theme) {
document.documentElement.setAttribute('data-theme', theme);
$_theme = theme;
console.log('切换主题:\t', theme);
}
// -----------------------------
// -----------------------------
// FIXME: 环境变量 -> 处理生产模式和开发模式的文件网络路径问题
// FIXME: 环境变量 -> 处理生产模式和开发模式的文件网络路径问题
...
@@ -199,7 +207,7 @@
...
@@ -199,7 +207,7 @@
/>
/>
</div>
</div>
<!-- NOTE: 功能区遍历 -->
<!-- NOTE:
(导航栏)
功能区遍历 -->
{#each injectText as Item}
{#each injectText as Item}
<li>
<li>
<div class="p-3 tooltip tooltip-left" data-tip={Item.hint}>
<div class="p-3 tooltip tooltip-left" data-tip={Item.hint}>
...
@@ -227,9 +235,7 @@
...
@@ -227,9 +235,7 @@
<button
<button
data-theme={theme}
data-theme={theme}
on:click={() => {
on:click={() => {
document.documentElement.setAttribute('data-theme', theme);
setTheme(theme);
$_theme = theme;
console.log('切换主题:\t', theme);
}}
}}
class="rounded my-1 flex justify-between items-center"
class="rounded my-1 flex justify-between items-center"
>
>
...
@@ -258,12 +264,43 @@
...
@@ -258,12 +264,43 @@
<div class="drawer-side z-[40]">
<div class="drawer-side z-[40]">
<label for="my-drawer-3" aria-label="close sidebar" class="drawer-overlay" />
<label for="my-drawer-3" aria-label="close sidebar" class="drawer-overlay" />
<ul class="menu p-4 w-60 min-h-full bg-base-200">
<ul class="menu p-4 w-60 min-h-full bg-base-200">
<!--
Sidebar content here
-->
<!--
NOTE: (侧边栏) 功能区遍历
-->
{#each injectText as Item}
{#each injectText as Item}
<li>
<li>
<button on:click={Item.click}>{Item.text}</button>
<button on:click={Item.click}>{Item.text}</button>
</li>
</li>
{/each}
{/each}
<!-- NOTE: 主题 -->
<li>
<details>
<summary>主题选择</summary>
<ul>
{#each themes as theme}
<li>
<button
data-theme={theme}
on:click={() => {
setTheme(theme);
}}
class="rounded my-1 flex justify-between items-center"
>
<div>
{theme}
</div>
<div class="flex h-full flex-shrink-0 flex-wrap gap-1">
<span class="bg-primary w-4 h-4 rounded-box" />
<span class="bg-secondary w-4 h-4 rounded-box" />
<span class="bg-accent w-4 h-4 rounded-box" />
<span class="bg-neutral w-4 h-4 rounded-box" />
</div>
</button>
</li>
{/each}
</ul>
</details>
</li>
</ul>
</ul>
</div>
</div>
</div>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment