Skip to content

Commit 03f1239

Browse files
committed
feat(qs-viewer): use sun/moon svg icon for theme toggle
1 parent c7f3b95 commit 03f1239

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

qs-viewer/src/App.tsx

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,30 @@ const App: React.FC = () => {
391391
<div className="sidebar-header">
392392
<h1 className="app-title">FLOSS</h1>
393393
<div className="sidebar-header-buttons">
394-
<button className="btn-ghost" onClick={() => setTheme(t => t === 'light' ? 'dark' : 'light')} title={theme === 'light' ? 'Switch to dark mode' : 'Switch to light mode'}>
395-
{theme === 'light' ? 'Dark' : 'Light'}
394+
<button
395+
className="btn-ghost"
396+
onClick={() => setTheme(t => t === 'light' ? 'dark' : 'light')}
397+
title={theme === 'light' ? 'Switch to dark mode' : 'Switch to light mode'}
398+
aria-label={theme === 'light' ? 'Switch to dark mode' : 'Switch to light mode'}
399+
style={{ display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 32, padding: '7px 0' }}
400+
>
401+
{theme === 'light' ? (
402+
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
403+
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
404+
</svg>
405+
) : (
406+
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
407+
<circle cx="12" cy="12" r="5" />
408+
<line x1="12" y1="1" x2="12" y2="3" />
409+
<line x1="12" y1="21" x2="12" y2="23" />
410+
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64" />
411+
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78" />
412+
<line x1="1" y1="12" x2="3" y2="12" />
413+
<line x1="21" y1="12" x2="23" y2="12" />
414+
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36" />
415+
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22" />
416+
</svg>
417+
)}
396418
</button>
397419
<button className="btn-ghost" onClick={handlePreview}>Preview</button>
398420
<label htmlFor="file-upload" className="btn-ghost" style={{ cursor: 'pointer' }}>

0 commit comments

Comments
 (0)