Skip to content

Commit b5f2d33

Browse files
authored
Add sidebar size setting (normal/small) (#397)
* Add sidebar size setting (normal/small) * Set default small sidebar size for small window
1 parent c459698 commit b5f2d33

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/components/sidebar/SideToolBar.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<teleport :to="teleportTarget">
3-
<nav class="side-tool-bar-container">
3+
<nav :class="'side-tool-bar-container' + (isSmall ? ' small-sidebar' : '')">
44
<SideBarIcon
55
v-for="tab in tabs"
66
:key="tab.id"
@@ -55,6 +55,10 @@ const teleportTarget = computed(() =>
5555
: '.comfyui-body-right'
5656
)
5757
58+
const isSmall = computed(
59+
() => settingStore.get('Comfy.SideBar.Size') === 'small'
60+
)
61+
5862
const tabs = computed(() => workspaceStore.getSidebarTabs())
5963
const selectedTab = computed<SidebarTabExtension | null>(() => {
6064
const tabId = workspaceStore.activeSidebarTab
@@ -82,6 +86,10 @@ onBeforeUnmount(() => {
8286
--sidebar-width: 64px;
8387
--sidebar-icon-size: 1.5rem;
8488
}
89+
:root .small-sidebar {
90+
--sidebar-width: 40px;
91+
--sidebar-icon-size: 1rem;
92+
}
8593
</style>
8694

8795
<style scoped>

src/stores/settingStore.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ export const useSettingStore = defineStore('setting', {
8989
options: ['left', 'right'],
9090
defaultValue: 'left'
9191
})
92+
93+
app.ui.settings.addSetting({
94+
id: 'Comfy.SideBar.Size',
95+
name: 'Sidebar size',
96+
type: 'combo',
97+
options: ['normal', 'small'],
98+
defaultValue: window.innerWidth < 1600 ? 'small' : 'normal'
99+
})
92100
},
93101

94102
set(key: string, value: any) {

0 commit comments

Comments
 (0)