Skip to content

Commit 43d632f

Browse files
committed
feat: update KeluhAdd and KeluhCard components for improved user input and localization
1 parent 9651b47 commit 43d632f

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/components/keluh-add.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function KeluhAdd({
3939
};
4040

4141
savePost(newPost);
42-
setFormData({ from: 'Anonim', to: '', message: '' });
42+
setFormData({ from: '', to: '', message: '' });
4343
onOpenChange(false);
4444
onPostCreated();
4545
};

src/components/keluh-card.tsx

+9-10
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function KeluhCard({ post, onUpdate }: KeluhCardProps) {
1919
const [isOpen, setIsOpen] = useState(false);
2020
const [showComments, setShowComments] = useState(false);
2121
const [comment, setComment] = useState('');
22-
const [commentFrom, setCommentFrom] = useState('Anonymous');
22+
const [commentFrom, setCommentFrom] = useState('');
2323

2424
const handleLove = (e: React.MouseEvent) => {
2525
e.stopPropagation();
@@ -33,12 +33,11 @@ export function KeluhCard({ post, onUpdate }: KeluhCardProps) {
3333

3434
addComment(post.id, {
3535
id: crypto.randomUUID(),
36-
from: commentFrom || 'Anonymous',
36+
from: commentFrom || 'Anonim',
3737
text: comment,
3838
timestamp: new Date().toISOString(),
3939
});
4040
setComment('');
41-
setCommentFrom('Anonymous');
4241
onUpdate();
4342
};
4443

@@ -54,7 +53,7 @@ export function KeluhCard({ post, onUpdate }: KeluhCardProps) {
5453
return (
5554
<>
5655
<Card
57-
className="h-[180px] p-4 bg-white dark:bg-gray-800 hover:shadow-lg transition-shadow cursor-pointer"
56+
className="h-[160px] p-5 bg-white dark:bg-gray-800 hover:shadow-lg transition-shadow cursor-pointer"
5857
onClick={() => setIsOpen(true)}
5958
>
6059
<div className="flex justify-between items-start mb-2">
@@ -74,13 +73,13 @@ export function KeluhCard({ post, onUpdate }: KeluhCardProps) {
7473
</div>
7574
</div>
7675

77-
<div className="h-[60px] overflow-hidden">
76+
<div className="h-[40px] overflow-hidden">
7877
<p className="text-sm line-clamp-2">
7978
{post.message}
8079
</p>
8180
</div>
8281

83-
<div className="flex items-center gap-4 mt-4">
82+
<div className="flex items-center gap-4 mt-2">
8483
<Button
8584
variant="ghost"
8685
size="sm"
@@ -103,7 +102,7 @@ export function KeluhCard({ post, onUpdate }: KeluhCardProps) {
103102
</Card>
104103

105104
<Dialog open={isOpen} onOpenChange={setIsOpen}>
106-
<DialogContent className="sm:max-w-[500px]">
105+
<DialogContent className="sm:max-w-[70vh] max-h-[80vh] overflow-y-auto">
107106
<DialogHeader>
108107
<DialogTitle>Untuk: {post.to}</DialogTitle>
109108
</DialogHeader>
@@ -148,19 +147,19 @@ export function KeluhCard({ post, onUpdate }: KeluhCardProps) {
148147
<div className="space-y-4">
149148
<form onSubmit={handleComment} className="flex gap-2">
150149
<Input
151-
placeholder="From (optional)"
150+
placeholder="Dari (Opsional)"
152151
value={commentFrom}
153152
onChange={(e) => setCommentFrom(e.target.value)}
154153
className="w-1/3"
155154
/>
156155
<Input
157-
placeholder="Add a comment..."
156+
placeholder="Tambahkan komentar..."
158157
value={comment}
159158
onChange={(e) => setComment(e.target.value)}
160159
className="flex-1"
161160
/>
162161
<Button type="submit" size="sm">
163-
Send
162+
Kirim
164163
</Button>
165164
</form>
166165

0 commit comments

Comments
 (0)