Skip to content

Commit 034af8e

Browse files
committed
webui: DaisyUI themes previews
1 parent 44f68e1 commit 034af8e

File tree

1 file changed

+30
-18
lines changed

1 file changed

+30
-18
lines changed

tools/server/webui/src/components/Header.tsx

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ import { useAppContext } from '../utils/app.context';
44
import { classNames } from '../utils/misc';
55
import daisyuiThemes from 'daisyui/theme/object';
66
import { THEMES } from '../Config';
7-
import {
8-
Cog8ToothIcon,
9-
MoonIcon,
10-
Bars3Icon,
11-
} from '@heroicons/react/24/outline';
7+
import { Cog8ToothIcon, Bars3Icon } from '@heroicons/react/24/outline';
128

139
export default function Header() {
1410
const [selectedTheme, setSelectedTheme] = useState(StorageUtils.getTheme());
@@ -72,34 +68,50 @@ export default function Header() {
7268
role="button"
7369
className="btn btn-ghost m-1 w-8 h-8 p-0 rounded-full"
7470
>
75-
<MoonIcon className="w-5 h-5" />
71+
<div className="bg-base-100 grid shrink-0 grid-cols-2 gap-1 rounded-md p-1 shadow-sm">
72+
<div className="bg-base-content size-1 rounded-full"></div>{' '}
73+
<div className="bg-primary size-1 rounded-full"></div>{' '}
74+
<div className="bg-secondary size-1 rounded-full"></div>{' '}
75+
<div className="bg-accent size-1 rounded-full"></div>
76+
</div>
7677
</div>
7778
<ul
7879
tabIndex={0}
79-
className="dropdown-content bg-base-300 rounded-box z-[1] w-52 p-2 shadow-2xl h-80 overflow-y-auto"
80+
className="dropdown-content rounded-box z-[1] w-50 p-2 shadow-2xl h-80 text-sm overflow-y-auto"
8081
>
8182
<li>
8283
<button
8384
className={classNames({
84-
'btn btn-sm btn-block btn-ghost justify-start': true,
85+
'flex gap-3 p-2 btn btn-sm btn-ghost': true,
8586
'btn-active': selectedTheme === 'auto',
8687
})}
8788
onClick={() => setTheme('auto')}
8889
>
89-
auto
90+
<div className="w-32 ml-6 pl-1 truncate text-left">auto</div>
9091
</button>
9192
</li>
9293
{THEMES.map((theme) => (
9394
<li key={theme}>
94-
<input
95-
type="radio"
96-
name="theme-dropdown"
97-
className="theme-controller btn btn-sm btn-block btn-ghost justify-start"
98-
aria-label={theme}
99-
value={theme}
100-
checked={selectedTheme === theme}
101-
onChange={(e) => e.target.checked && setTheme(theme)}
102-
/>
95+
<button
96+
className={classNames({
97+
'flex gap-3 p-2 btn btn-sm btn-ghost': true,
98+
'btn-active': selectedTheme === theme,
99+
})}
100+
data-set-theme={theme}
101+
data-act-class="[&amp;_svg]:visible"
102+
onClick={() => setTheme(theme)}
103+
>
104+
<div
105+
data-theme={theme}
106+
className="bg-base-100 grid shrink-0 grid-cols-2 gap-0.5 rounded-md p-1 shadow-sm"
107+
>
108+
<div className="bg-base-content size-1 rounded-full"></div>{' '}
109+
<div className="bg-primary size-1 rounded-full"></div>{' '}
110+
<div className="bg-secondary size-1 rounded-full"></div>{' '}
111+
<div className="bg-accent size-1 rounded-full"></div>
112+
</div>
113+
<div className="w-32 truncate text-left">{theme}</div>
114+
</button>
103115
</li>
104116
))}
105117
</ul>

0 commit comments

Comments
 (0)