Skip to content

Commit 1d64282

Browse files
committed
refactor(ui): improve post form styling and layout
- Add max-width and proper centering to form container - Improve button styling with modern design and hover states - Update form spacing and visual hierarchy - Add consistent rounded corners and padding - Make textarea size fixed with better default height
1 parent 78594ff commit 1d64282

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

app/src/components/PostForm.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ export default function PostForm(): ReactElement {
3434
}
3535

3636
return (
37-
<div style={{ margin: "16px" }}>
37+
<div className="mt-8 max-w-2xl mx-auto px-4">
3838
<form onSubmit={handleSubmit} role="form" aria-label="Create new post">
39-
<div className="space-y-4">
40-
<div>
39+
<div className="space-y-2">
40+
<div className="space-y-2">
4141
<label htmlFor="head" className="block text-sm font-medium text-gray-700 dark:text-gray-300">
4242
What's on your mind?
4343
</label>
4444
<textarea
4545
ref={textareaRef}
46-
className="w-full p-3 border rounded-lg shadow-sm focus:ring-2 focus:ring-blue-500 focus:outline-none"
46+
className="w-full p-4 border rounded-xl shadow-sm focus:ring-2 focus:ring-blue-500 focus:outline-none resize-none"
4747
id="head"
4848
name="head"
4949
value={form.head}
@@ -59,6 +59,7 @@ export default function PostForm(): ReactElement {
5959
placeholder="Share your thoughts..."
6060
aria-label="Post content"
6161
tabIndex={1}
62+
rows={3}
6263
/>
6364
</div>
6465
<div style={{ display: "none" }}>
@@ -77,10 +78,10 @@ export default function PostForm(): ReactElement {
7778
tabIndex={-1}
7879
/>
7980
</div>
80-
<div>
81+
<div className="flex justify-end">
8182
<button
8283
type="submit"
83-
className="px-4 py-2 border border-transparent text-base font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:bg-indigo-800 md:px-5 md:text-lg focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
84+
className="w-full sm:w-auto px-6 py-3 text-base font-medium rounded-xl shadow-sm text-white bg-indigo-600 hover:bg-indigo-500 active:bg-indigo-700 transition-colors duration-150 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 disabled:opacity-50"
8485
tabIndex={2}
8586
>
8687
Send

app/src/pages/Index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ export default function Index(): ReactElement {
1010
<>
1111
<Head title="wut up" />
1212
<Header />
13-
<PostForm />
13+
<div className="w-full">
14+
<PostForm />
15+
</div>
1416
<PostList />
1517
</>
1618
);

0 commit comments

Comments
 (0)