Skip to content

Commit cd04efc

Browse files
committed
feat: add dark mode support to admin dashboard and tutorial form
- Applied dark mode styling to TutorialForm component with slate color scheme for backgrounds, borders, and text - Updated AdminDashboard with dark mode classes for header, navigation, tabs, and main content areas - Enhanced visual consistency with dark mode variants for buttons, inputs, and interactive elements
1 parent 877f482 commit cd04efc

File tree

2 files changed

+37
-37
lines changed

2 files changed

+37
-37
lines changed

src/components/TutorialForm.jsx

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -148,73 +148,73 @@ const TutorialForm = ({ tutorial, onClose }) => {
148148
}
149149

150150
return (
151-
<div className="p-8">
151+
<div className="p-8 bg-white dark:bg-slate-900 text-gray-900 dark:text-slate-100">
152152
{/* Header */}
153153
<div className="flex justify-between items-center mb-6">
154-
<h2 id="modal-title" className="text-2xl font-bold text-gray-800">
154+
<h2 id="modal-title" className="text-2xl font-bold text-gray-800 dark:text-slate-100">
155155
{tutorial ? 'Tutorial bearbeiten' : 'Neues Tutorial erstellen'}
156156
</h2>
157157
<button
158158
onClick={onClose}
159-
className="p-2 hover:bg-gray-100 rounded-lg transition-colors duration-200"
159+
className="p-2 hover:bg-gray-100 dark:hover:bg-slate-800 rounded-lg transition-colors duration-200"
160160
>
161-
<X className="w-6 h-6 text-gray-600" />
161+
<X className="w-6 h-6 text-gray-600 dark:text-slate-300" />
162162
</button>
163163
</div>
164164

165165
{/* Form */}
166166
<form onSubmit={handleSubmit} className="space-y-6">
167167
{formError && (
168-
<div className="flex items-start gap-3 rounded-lg border border-red-200 bg-red-50 p-4 text-red-700" role="alert">
168+
<div className="flex items-start gap-3 rounded-lg border border-red-200 bg-red-50 p-4 text-red-700 dark:border-red-900/40 dark:bg-red-900/20 dark:text-red-300" role="alert">
169169
<AlertCircle className="w-5 h-5 mt-0.5" aria-hidden="true" />
170170
<span className="text-sm">{formError}</span>
171171
</div>
172172
)}
173173

174174
{/* Title */}
175175
<div>
176-
<label className="block text-sm font-medium text-gray-700 mb-2">
176+
<label className="block text-sm font-medium text-gray-700 dark:text-slate-300 mb-2">
177177
Titel *
178178
</label>
179179
<input
180180
type="text"
181181
value={formData.title}
182182
onChange={(e) => setFormData({ ...formData, title: e.target.value })}
183-
className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-transparent"
183+
className="w-full px-4 py-2 border border-gray-300 dark:border-slate-700 rounded-lg bg-white dark:bg-slate-800 text-gray-900 dark:text-slate-100 focus:ring-2 focus:ring-primary-500 focus:border-transparent"
184184
placeholder="z.B. Grundlegende Befehle"
185185
maxLength={200}
186186
required
187187
/>
188-
<p className="mt-1 text-xs text-gray-500">{formData.title.length}/200 Zeichen</p>
188+
<p className="mt-1 text-xs text-gray-500 dark:text-slate-400">{formData.title.length}/200 Zeichen</p>
189189
</div>
190190

191191
{/* Description */}
192192
<div>
193-
<label className="block text-sm font-medium text-gray-700 mb-2">
193+
<label className="block text-sm font-medium text-gray-700 dark:text-slate-300 mb-2">
194194
Beschreibung *
195195
</label>
196196
<textarea
197197
value={formData.description}
198198
onChange={(e) => setFormData({ ...formData, description: e.target.value })}
199-
className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-transparent"
199+
className="w-full px-4 py-2 border border-gray-300 dark:border-slate-700 rounded-lg bg-white dark:bg-slate-800 text-gray-900 dark:text-slate-100 focus:ring-2 focus:ring-primary-500 focus:border-transparent"
200200
rows="3"
201201
placeholder="Kurze Beschreibung des Tutorials"
202202
maxLength={1000}
203203
required
204204
/>
205-
<p className="mt-1 text-xs text-gray-500">{formData.description.length}/1000 Zeichen</p>
205+
<p className="mt-1 text-xs text-gray-500 dark:text-slate-400">{formData.description.length}/1000 Zeichen</p>
206206
</div>
207207

208208
{/* Icon & Color */}
209209
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
210210
<div>
211-
<label className="block text-sm font-medium text-gray-700 mb-2">
211+
<label className="block text-sm font-medium text-gray-700 dark:text-slate-300 mb-2">
212212
Icon
213213
</label>
214214
<select
215215
value={formData.icon}
216216
onChange={(e) => setFormData({ ...formData, icon: e.target.value })}
217-
className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-transparent"
217+
className="w-full px-4 py-2 border border-gray-300 dark:border-slate-700 rounded-lg bg-white dark:bg-slate-800 text-gray-900 dark:text-slate-100 focus:ring-2 focus:ring-primary-500 focus:border-transparent"
218218
>
219219
{iconOptions.map((icon) => (
220220
<option key={icon} value={icon}>
@@ -225,13 +225,13 @@ const TutorialForm = ({ tutorial, onClose }) => {
225225
</div>
226226

227227
<div>
228-
<label className="block text-sm font-medium text-gray-700 mb-2">
228+
<label className="block text-sm font-medium text-gray-700 dark:text-slate-300 mb-2">
229229
Farbe
230230
</label>
231231
<select
232232
value={formData.color}
233233
onChange={(e) => setFormData({ ...formData, color: e.target.value })}
234-
className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-transparent"
234+
className="w-full px-4 py-2 border border-gray-300 dark:border-slate-700 rounded-lg bg-white dark:bg-slate-800 text-gray-900 dark:text-slate-100 focus:ring-2 focus:ring-primary-500 focus:border-transparent"
235235
>
236236
{colorOptions.map((color) => (
237237
<option key={color.value} value={color.value}>
@@ -245,7 +245,7 @@ const TutorialForm = ({ tutorial, onClose }) => {
245245
{/* Topics */}
246246
<div>
247247
<div className="flex justify-between items-center mb-2">
248-
<label className="block text-sm font-medium text-gray-700">
248+
<label className="block text-sm font-medium text-gray-700 dark:text-slate-300">
249249
Themen
250250
</label>
251251
<button
@@ -264,15 +264,15 @@ const TutorialForm = ({ tutorial, onClose }) => {
264264
type="text"
265265
value={topic}
266266
onChange={(e) => handleTopicChange(index, e.target.value)}
267-
className="flex-1 px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-transparent"
267+
className="flex-1 px-4 py-2 border border-gray-300 dark:border-slate-700 rounded-lg bg-white dark:bg-slate-800 text-gray-900 dark:text-slate-100 focus:ring-2 focus:ring-primary-500 focus:border-transparent"
268268
placeholder={`Thema ${index + 1}`}
269269
maxLength={100}
270270
/>
271271
{formData.topics.length > 1 && (
272272
<button
273273
type="button"
274274
onClick={() => removeTopic(index)}
275-
className="p-2 text-red-600 hover:bg-red-50 rounded-lg transition-colors duration-200"
275+
className="p-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors duration-200"
276276
>
277277
<Trash2 className="w-5 h-5" />
278278
</button>
@@ -284,22 +284,22 @@ const TutorialForm = ({ tutorial, onClose }) => {
284284

285285
{/* Content */}
286286
<div>
287-
<label className="block text-sm font-medium text-gray-700 mb-2">
287+
<label className="block text-sm font-medium text-gray-700 dark:text-slate-300 mb-2">
288288
Inhalt (Markdown unterstützt)
289289
</label>
290290
<textarea
291291
value={formData.content}
292292
onChange={(e) => setFormData({ ...formData, content: e.target.value })}
293-
className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-transparent font-mono text-sm"
293+
className="w-full px-4 py-2 border border-gray-300 dark:border-slate-700 rounded-lg bg-white dark:bg-slate-900 text-gray-900 dark:text-slate-100 focus:ring-2 focus:ring-primary-500 focus:border-transparent font-mono text-sm"
294294
rows="10"
295295
placeholder="Hier kannst du den vollständigen Tutorial-Inhalt eingeben..."
296296
maxLength={100000}
297297
/>
298-
<p className="mt-1 text-xs text-gray-500">{formData.content.length}/100000 Zeichen</p>
298+
<p className="mt-1 text-xs text-gray-500 dark:text-slate-400">{formData.content.length}/100000 Zeichen</p>
299299
</div>
300300

301301
{/* Actions */}
302-
<div className="flex space-x-4 pt-4 border-t border-gray-200">
302+
<div className="flex space-x-4 pt-4 border-t border-gray-200 dark:border-slate-800">
303303
<button
304304
type="submit"
305305
className="flex-1 flex items-center justify-center space-x-2 px-6 py-3 bg-gradient-to-r from-primary-600 to-primary-700 text-white rounded-lg hover:from-primary-700 hover:to-primary-800 transition-all duration-200 shadow-lg hover:shadow-xl disabled:opacity-60"
@@ -311,7 +311,7 @@ const TutorialForm = ({ tutorial, onClose }) => {
311311
<button
312312
type="button"
313313
onClick={onClose}
314-
className="px-6 py-3 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition-colors duration-200"
314+
className="px-6 py-3 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition-colors duration-200 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700"
315315
>
316316
Abbrechen
317317
</button>

src/pages/AdminDashboard.jsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,31 +113,31 @@ const AdminDashboard = () => {
113113
}, [showForm])
114114

115115
return (
116-
<div className="min-h-screen bg-gray-50">
116+
<div className="min-h-screen bg-gray-50 dark:bg-slate-950 text-gray-900 dark:text-slate-100">
117117
{/* Header */}
118-
<header className="bg-white shadow-md">
118+
<header className="bg-white/90 dark:bg-slate-900/80 shadow-md backdrop-blur">
119119
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4">
120120
<div className="flex justify-between items-center">
121121
<div className="flex items-center space-x-3">
122-
<div className="bg-gradient-to-r from-primary-600 to-primary-800 p-2 rounded-lg">
122+
<div className="bg-gradient-to-r from-primary-600 to-primary-800 p-2 rounded-lg shadow-lg shadow-primary-900/20">
123123
<Terminal className="w-6 h-6 text-white" />
124124
</div>
125125
<div>
126-
<h1 className="text-2xl font-bold text-gray-900">Admin Dashboard</h1>
127-
<p className="text-sm text-gray-600">Willkommen, {user?.username}</p>
126+
<h1 className="text-2xl font-bold text-gray-900 dark:text-slate-100">Admin Dashboard</h1>
127+
<p className="text-sm text-gray-600 dark:text-slate-400">Willkommen, {user?.username}</p>
128128
</div>
129129
</div>
130130
<div className="flex space-x-3">
131131
<button
132132
onClick={() => navigate('/')}
133-
className="flex items-center space-x-2 px-4 py-2 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition-colors duration-200"
133+
className="flex items-center space-x-2 px-4 py-2 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition-colors duration-200 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700"
134134
>
135135
<Home className="w-4 h-4" />
136136
<span>Startseite</span>
137137
</button>
138138
<button
139139
onClick={handleLogout}
140-
className="flex items-center space-x-2 px-4 py-2 bg-red-100 text-red-700 rounded-lg hover:bg-red-200 transition-colors duration-200"
140+
className="flex items-center space-x-2 px-4 py-2 bg-red-100 text-red-700 rounded-lg hover:bg-red-200 transition-colors duration-200 dark:bg-red-900/30 dark:text-red-300 dark:hover:bg-red-900/50"
141141
>
142142
<LogOut className="w-4 h-4" />
143143
<span>Abmelden</span>
@@ -150,15 +150,15 @@ const AdminDashboard = () => {
150150
{/* Main Content */}
151151
<main className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
152152
{/* Tabs */}
153-
<div className="mb-8 flex flex-col gap-3 border-b border-gray-200 pb-3 sm:flex-row sm:items-center sm:justify-between">
153+
<div className="mb-8 flex flex-col gap-3 border-b border-gray-200 pb-3 sm:flex-row sm:items-center sm:justify-between dark:border-slate-800">
154154
<div className="flex flex-wrap items-center gap-2">
155155
<button
156156
type="button"
157157
onClick={() => setActiveTab('tutorials')}
158158
className={`inline-flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium transition-all ${
159159
activeTab === 'tutorials'
160-
? 'bg-primary-600 text-white shadow-lg'
161-
: 'bg-gray-100 text-gray-700 hover:bg-gray-200'
160+
? 'bg-primary-600 text-white shadow-lg shadow-primary-900/20'
161+
: 'bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700'
162162
}`}
163163
>
164164
<LayoutDashboard className="h-4 w-4" />
@@ -169,8 +169,8 @@ const AdminDashboard = () => {
169169
onClick={() => setActiveTab('content')}
170170
className={`inline-flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium transition-all ${
171171
activeTab === 'content'
172-
? 'bg-primary-600 text-white shadow-lg'
173-
: 'bg-gray-100 text-gray-700 hover:bg-gray-200'
172+
? 'bg-primary-600 text-white shadow-lg shadow-primary-900/20'
173+
: 'bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700'
174174
}`}
175175
>
176176
<Paintbrush className="h-4 w-4" />
@@ -181,8 +181,8 @@ const AdminDashboard = () => {
181181
onClick={() => setActiveTab('pages')}
182182
className={`inline-flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium transition-all ${
183183
activeTab === 'pages'
184-
? 'bg-primary-600 text-white shadow-lg'
185-
: 'bg-gray-100 text-gray-700 hover:bg-gray-200'
184+
? 'bg-primary-600 text-white shadow-lg shadow-primary-900/20'
185+
: 'bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700'
186186
}`}
187187
>
188188
<FileText className="h-4 w-4" />

0 commit comments

Comments
 (0)