Skip to content

Commit 6b17820

Browse files
committed
feat: add theme toggle button in header
1 parent 3e5ef4c commit 6b17820

2 files changed

Lines changed: 40 additions & 14 deletions

File tree

src/components/Layout/Header.jsx

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,44 @@
1+
import { useTheme } from '../../hooks/useTheme';
2+
13
const Header = () => {
4+
const { isDark, toggleTheme } = useTheme();
5+
26
return (
37
<div className="win98-inset" style={{
48
padding: '12px',
59
marginBottom: '8px',
610
backgroundColor: 'var(--win95-light-gray)'
711
}}>
8-
<h1 style={{ fontSize: '18px', fontWeight: 'bold', marginBottom: '4px' }}>
9-
Windows Post-Install Generator
10-
</h1>
11-
<p style={{ fontSize: '12px', color: 'var(--win98-gray-dark)', lineHeight: '1.5' }}>
12-
Create custom installation script that:<br />
13-
• automatically installs selected programs<br />
14-
• adjusts selected settings<br />
15-
Everything automatically<br />
16-
<br />
17-
Right-click the downloaded .bat file and select "Run as Administrator"
18-
</p>
12+
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start', gap: '12px' }}>
13+
<div style={{ flex: 1 }}>
14+
<h1 style={{ fontSize: '18px', fontWeight: 'bold', marginBottom: '4px' }}>
15+
Windows Post-Install Generator
16+
</h1>
17+
<p style={{ fontSize: '12px', color: 'var(--win98-gray-dark)', lineHeight: '1.5' }}>
18+
Create custom installation script that:<br />
19+
• automatically installs selected programs<br />
20+
• adjusts selected settings<br />
21+
Everything automatically<br />
22+
<br />
23+
Right-click the downloaded .bat file and select "Run as Administrator"
24+
</p>
25+
</div>
26+
<button
27+
onClick={toggleTheme}
28+
className="win95-button"
29+
style={{
30+
padding: '6px 12px',
31+
display: 'flex',
32+
alignItems: 'center',
33+
gap: '6px',
34+
minWidth: '100px'
35+
}}
36+
title={isDark ? 'Switch to Light Mode' : 'Switch to Dark Mode'}
37+
>
38+
<span style={{ fontSize: '14px' }}>{isDark ? '☀' : '☾'}</span>
39+
<span>{isDark ? 'Light' : 'Dark'}</span>
40+
</button>
41+
</div>
1942
</div>
2043
);
2144
};

src/main.jsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ import { createRoot } from 'react-dom/client'
33
import './index.css'
44
import App from './App.jsx'
55
import { SelectionProvider } from './context/SelectionContext.jsx'
6+
import { ThemeProvider } from './context/ThemeContext.jsx'
67

78
createRoot(document.getElementById('root')).render(
89
<StrictMode>
9-
<SelectionProvider>
10-
<App />
11-
</SelectionProvider>
10+
<ThemeProvider>
11+
<SelectionProvider>
12+
<App />
13+
</SelectionProvider>
14+
</ThemeProvider>
1215
</StrictMode>,
1316
)

0 commit comments

Comments
 (0)