Skip to content

Commit 0424c1d

Browse files
committed
feat: redesign contact form with improved layout and styling
- Remove modal styling (borders, background) and keep only backdrop - Create connected pills for employment status with no default selection - Reorganize form into logical sections: Basic Info, Professional Background, Discussion - Group occupation, employment status, and workplace in Professional Background section - Move discussion title to section level and remove redundant field label - Update all styling to white theme for better contrast on dark backdrop - Improve employment status UI with connected pill design - Add proper hover states and transitions for better UX - Remove unused imports and fix JSX structure - Optimize form layout for better logical flow and user experience
1 parent c149186 commit 0424c1d

File tree

1 file changed

+110
-94
lines changed

1 file changed

+110
-94
lines changed

src/components/ui/ContactForm.tsx

Lines changed: 110 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { useState } from 'react';
44
import { motion, AnimatePresence } from 'framer-motion';
5-
import { X, Send, User, Mail, MessageSquare, Briefcase, Linkedin, Building, Check, AlertCircle } from 'lucide-react';
5+
import { X, Send, User, Mail, Briefcase, Linkedin, Building, Check, AlertCircle } from 'lucide-react';
66
import emailjs from '@emailjs/browser';
77

88
interface ContactFormProps {
@@ -16,7 +16,7 @@ const ContactForm = ({ isOpen, onClose }: ContactFormProps) => {
1616
email: '',
1717
occupation: '',
1818
linkedin: '',
19-
employmentStatus: 'yes', // 'yes', 'no', 'student'
19+
employmentStatus: '', // 'yes', 'no', 'student', or empty
2020
workplace: '',
2121
discussion: '',
2222
});
@@ -126,7 +126,7 @@ ${formData.discussion}
126126
email: '',
127127
occupation: '',
128128
linkedin: '',
129-
employmentStatus: 'yes',
129+
employmentStatus: '',
130130
workplace: '',
131131
discussion: '',
132132
});
@@ -170,30 +170,27 @@ ${formData.discussion}
170170
}}
171171
onClick={(e) => e.stopPropagation()}
172172
>
173-
{/* Form Card */}
174-
<div className="bg-background border border-border rounded-2xl shadow-2xl w-full max-w-4xl max-h-[90vh] flex flex-col">
175-
{/* Header */}
176-
<div className="flex items-center justify-between p-6 border-b border-border flex-shrink-0">
177-
<h1 className="text-2xl font-bold text-foreground">Coffee Chat Request</h1>
178-
<button
179-
onClick={onClose}
180-
className="p-2 rounded-lg hover:bg-muted/50 transition-colors"
181-
>
182-
<X className="w-6 h-6 text-muted-foreground" />
183-
</button>
184-
</div>
173+
{/* Header */}
174+
<div className="absolute top-4 right-4 z-10">
175+
<button
176+
onClick={onClose}
177+
className="p-2 rounded-lg hover:bg-white/10 transition-colors"
178+
>
179+
<X className="w-6 h-6 text-white" />
180+
</button>
181+
</div>
185182

186-
{/* Form */}
187-
<div className="flex-1 overflow-y-auto p-6">
183+
{/* Form */}
184+
<div className="w-full max-w-4xl max-h-[90vh] overflow-y-auto">
188185
<form onSubmit={handleSubmit} className="space-y-8">
189-
{/* Section 1: About You */}
186+
{/* Section 1: Basic Info */}
190187
<div className="space-y-4">
191-
<h2 className="text-lg font-semibold text-foreground">About You</h2>
188+
<h2 className="text-lg font-semibold text-white">Basic Information</h2>
192189

193190
<div className="grid grid-cols-1 lg:grid-cols-2 gap-4">
194191
{/* Name */}
195192
<div>
196-
<label className="block text-sm font-medium text-foreground mb-2">
193+
<label className="block text-sm font-medium text-white mb-2">
197194
<User className="w-4 h-4 inline mr-2" />
198195
Name *
199196
</label>
@@ -203,14 +200,14 @@ ${formData.discussion}
203200
value={formData.name}
204201
onChange={handleInputChange}
205202
required
206-
className="w-full px-4 py-3 bg-muted/30 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent transition-all"
203+
className="w-full px-4 py-3 bg-white/10 border border-white/20 rounded-lg focus:ring-2 focus:ring-white/50 focus:border-transparent transition-all text-white placeholder-white/70"
207204
placeholder="Your full name"
208205
/>
209206
</div>
210207

211208
{/* Email */}
212209
<div>
213-
<label className="block text-sm font-medium text-foreground mb-2">
210+
<label className="block text-sm font-medium text-white mb-2">
214211
<Mail className="w-4 h-4 inline mr-2" />
215212
Email *
216213
</label>
@@ -220,31 +217,14 @@ ${formData.discussion}
220217
value={formData.email}
221218
onChange={handleInputChange}
222219
required
223-
className="w-full px-4 py-3 bg-muted/30 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent transition-all"
220+
className="w-full px-4 py-3 bg-white/10 border border-white/20 rounded-lg focus:ring-2 focus:ring-white/50 focus:border-transparent transition-all text-white placeholder-white/70"
224221
placeholder="your.email@example.com"
225222
/>
226223
</div>
227224

228-
{/* Occupation */}
229-
<div>
230-
<label className="block text-sm font-medium text-foreground mb-2">
231-
<Briefcase className="w-4 h-4 inline mr-2" />
232-
Occupation *
233-
</label>
234-
<input
235-
type="text"
236-
name="occupation"
237-
value={formData.occupation}
238-
onChange={handleInputChange}
239-
required
240-
className="w-full px-4 py-3 bg-muted/30 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent transition-all"
241-
placeholder="e.g., Product Designer, UX Researcher, Developer"
242-
/>
243-
</div>
244-
245225
{/* LinkedIn */}
246-
<div>
247-
<label className="block text-sm font-medium text-foreground mb-2">
226+
<div className="lg:col-span-2">
227+
<label className="block text-sm font-medium text-white mb-2">
248228
<Linkedin className="w-4 h-4 inline mr-2" />
249229
LinkedIn Profile
250230
</label>
@@ -253,69 +233,110 @@ ${formData.discussion}
253233
name="linkedin"
254234
value={formData.linkedin}
255235
onChange={handleInputChange}
256-
className="w-full px-4 py-3 bg-muted/30 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent transition-all"
236+
className="w-full px-4 py-3 bg-white/10 border border-white/20 rounded-lg focus:ring-2 focus:ring-white/50 focus:border-transparent transition-all text-white placeholder-white/70"
257237
placeholder="https://linkedin.com/in/yourname"
258238
/>
259239
</div>
260240
</div>
261241
</div>
262242

263-
{/* Section 2: Employment Status */}
243+
{/* Section 2: Professional Background */}
264244
<div className="space-y-4">
265-
<h2 className="text-lg font-semibold text-foreground">Employment Status</h2>
245+
<h2 className="text-lg font-semibold text-white">Professional Background</h2>
266246

267-
<div className="flex flex-wrap gap-3">
268-
<label className="flex items-center space-x-2 cursor-pointer px-4 py-2 rounded-lg border border-border hover:bg-muted/30 transition-colors">
269-
<input
270-
type="radio"
271-
name="employmentStatus"
272-
value="yes"
273-
checked={formData.employmentStatus === 'yes'}
274-
onChange={handleRadioChange}
275-
className="w-4 h-4 text-primary bg-muted/30 border-border focus:ring-primary"
276-
/>
277-
<span className="text-sm font-medium">Yes</span>
278-
</label>
279-
280-
<label className="flex items-center space-x-2 cursor-pointer px-4 py-2 rounded-lg border border-border hover:bg-muted/30 transition-colors">
281-
<input
282-
type="radio"
283-
name="employmentStatus"
284-
value="no"
285-
checked={formData.employmentStatus === 'no'}
286-
onChange={handleRadioChange}
287-
className="w-4 h-4 text-primary bg-muted/30 border-border focus:ring-primary"
288-
/>
289-
<span className="text-sm font-medium">No</span>
247+
{/* Occupation */}
248+
<div>
249+
<label className="block text-sm font-medium text-white mb-2">
250+
<Briefcase className="w-4 h-4 inline mr-2" />
251+
Occupation *
290252
</label>
291-
292-
<label className="flex items-center space-x-2 cursor-pointer px-4 py-2 rounded-lg border border-border hover:bg-muted/30 transition-colors">
293-
<input
294-
type="radio"
295-
name="employmentStatus"
296-
value="student"
297-
checked={formData.employmentStatus === 'student'}
298-
onChange={handleRadioChange}
299-
className="w-4 h-4 text-primary bg-muted/30 border-border focus:ring-primary"
300-
/>
301-
<span className="text-sm font-medium">Student</span>
253+
<input
254+
type="text"
255+
name="occupation"
256+
value={formData.occupation}
257+
onChange={handleInputChange}
258+
required
259+
className="w-full px-4 py-3 bg-white/10 border border-white/20 rounded-lg focus:ring-2 focus:ring-white/50 focus:border-transparent transition-all text-white placeholder-white/70"
260+
placeholder="e.g., Product Designer, UX Researcher, Developer"
261+
/>
262+
</div>
263+
264+
{/* Employment Status - Connected Pills */}
265+
<div>
266+
<label className="block text-sm font-medium text-white mb-3">
267+
Are you currently employed? *
302268
</label>
269+
<div className="flex">
270+
<label className="flex-1 cursor-pointer">
271+
<input
272+
type="radio"
273+
name="employmentStatus"
274+
value="yes"
275+
checked={formData.employmentStatus === 'yes'}
276+
onChange={handleRadioChange}
277+
className="sr-only"
278+
/>
279+
<div className={`px-4 py-3 text-center border border-white/20 transition-all ${
280+
formData.employmentStatus === 'yes'
281+
? 'bg-white text-black border-white'
282+
: 'bg-white/10 text-white hover:bg-white/20'
283+
}`}>
284+
Yes
285+
</div>
286+
</label>
287+
288+
<label className="flex-1 cursor-pointer">
289+
<input
290+
type="radio"
291+
name="employmentStatus"
292+
value="no"
293+
checked={formData.employmentStatus === 'no'}
294+
onChange={handleRadioChange}
295+
className="sr-only"
296+
/>
297+
<div className={`px-4 py-3 text-center border-t border-b border-white/20 transition-all ${
298+
formData.employmentStatus === 'no'
299+
? 'bg-white text-black border-white'
300+
: 'bg-white/10 text-white hover:bg-white/20'
301+
}`}>
302+
No
303+
</div>
304+
</label>
305+
306+
<label className="flex-1 cursor-pointer">
307+
<input
308+
type="radio"
309+
name="employmentStatus"
310+
value="student"
311+
checked={formData.employmentStatus === 'student'}
312+
onChange={handleRadioChange}
313+
className="sr-only"
314+
/>
315+
<div className={`px-4 py-3 text-center border border-white/20 transition-all ${
316+
formData.employmentStatus === 'student'
317+
? 'bg-white text-black border-white'
318+
: 'bg-white/10 text-white hover:bg-white/20'
319+
}`}>
320+
Student
321+
</div>
322+
</label>
323+
</div>
303324
</div>
304325

305326
{/* Workplace Input - only show if employed */}
306327
{formData.employmentStatus === 'yes' && (
307328
<div>
308-
<label className="block text-sm font-medium text-foreground mb-2">
329+
<label className="block text-sm font-medium text-white mb-2">
309330
<Building className="w-4 h-4 inline mr-2" />
310-
What is your current workplace? *
331+
Current Workplace *
311332
</label>
312333
<input
313334
type="text"
314335
name="workplace"
315336
value={formData.workplace}
316337
onChange={handleInputChange}
317338
required
318-
className="w-full px-4 py-3 bg-muted/30 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent transition-all"
339+
className="w-full px-4 py-3 bg-white/10 border border-white/20 rounded-lg focus:ring-2 focus:ring-white/50 focus:border-transparent transition-all text-white placeholder-white/70"
319340
placeholder="Your current company or organization"
320341
/>
321342
</div>
@@ -324,39 +345,35 @@ ${formData.discussion}
324345

325346
{/* Section 3: Discussion Topic */}
326347
<div className="space-y-4">
327-
<h2 className="text-lg font-semibold text-foreground">Discussion Topic</h2>
348+
<h2 className="text-lg font-semibold text-white">What would you like to discuss with us?</h2>
328349

329350
<div>
330-
<label className="block text-sm font-medium text-foreground mb-2">
331-
<MessageSquare className="w-4 h-4 inline mr-2" />
332-
What would you like to discuss? *
333-
</label>
334351
<textarea
335352
name="discussion"
336353
value={formData.discussion}
337354
onChange={handleInputChange}
338355
required
339-
rows={3}
340-
className="w-full px-4 py-3 bg-muted/30 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent transition-all resize-none"
356+
rows={4}
357+
className="w-full px-4 py-3 bg-white/10 border border-white/20 rounded-lg focus:ring-2 focus:ring-white/50 focus:border-transparent transition-all resize-none text-white placeholder-white/70"
341358
placeholder="Tell us what you'd like to discuss..."
342359
/>
343360
</div>
344361
</div>
345362

346363
{/* Error Message */}
347364
{error && (
348-
<div className="flex items-center space-x-2 p-4 bg-red-500/10 border border-red-500/20 rounded-lg text-red-600">
365+
<div className="flex items-center space-x-2 p-4 bg-red-500/20 border border-red-500/30 rounded-lg text-red-300">
349366
<AlertCircle className="w-5 h-5" />
350367
<span>{error}</span>
351368
</div>
352369
)}
353370

354371
{/* Submit Button */}
355-
<div className="flex justify-end space-x-4 pt-8 border-t border-border">
372+
<div className="flex justify-end space-x-4 pt-8">
356373
<button
357374
type="button"
358375
onClick={onClose}
359-
className="px-8 py-3 text-muted-foreground hover:text-foreground transition-colors font-medium"
376+
className="px-8 py-3 text-white/70 hover:text-white transition-colors font-medium"
360377
>
361378
Cancel
362379
</button>
@@ -365,7 +382,7 @@ ${formData.discussion}
365382
disabled={isSubmitting || isSubmitted}
366383
whileHover={{ scale: 1.02 }}
367384
whileTap={{ scale: 0.98 }}
368-
className="flex items-center space-x-2 px-8 py-3 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-all disabled:opacity-50 disabled:cursor-not-allowed font-medium"
385+
className="flex items-center space-x-2 px-8 py-3 bg-white text-black rounded-lg hover:bg-white/90 transition-all disabled:opacity-50 disabled:cursor-not-allowed font-medium"
369386
>
370387
{isSubmitted ? (
371388
<>
@@ -381,7 +398,6 @@ ${formData.discussion}
381398
</motion.button>
382399
</div>
383400
</form>
384-
</div>
385401
</div>
386402
</motion.div>
387403
</AnimatePresence>

0 commit comments

Comments
 (0)