Skip to content

Commit 900ad05

Browse files
committed
humanListItemを軽く修正
1 parent 21e3c9c commit 900ad05

File tree

1 file changed

+49
-69
lines changed

1 file changed

+49
-69
lines changed
Lines changed: 49 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import UserAvatar from "./avatar";
2-
31
import Dots from "../common/Dots";
2+
import UserAvatar from "./avatar";
43

54
type HumanListItemProps = {
65
id: number;
@@ -31,40 +30,65 @@ export function HumanListItem(props: HumanListItemProps) {
3130
onCancel,
3231
hasDots,
3332
} = props;
33+
3434
const handleDeleteClick = () => {
3535
if (!onDelete) return;
3636
onDelete(id);
3737
};
38+
3839
const handleOpenClick = () => {
3940
if (!onOpen) return;
4041
onOpen({ id, name, pictureUrl });
4142
};
4243

4344
return (
44-
<li key={id.toString()}>
45-
<button type="button" onClick={handleOpenClick} className="btn cm-li-btn">
46-
<div className="flex flex-1 gap-6">
45+
<div
46+
className="flex items-center justify-between border-b p-4"
47+
key={id.toString()}
48+
>
49+
{/* biome-ignore lint/a11y/useButtonType: <explanation> */}
50+
<button
51+
className="flex w-full items-center text-left"
52+
onClick={handleOpenClick}
53+
>
54+
<div className="ml-2">
4755
<UserAvatar pictureUrl={pictureUrl} width="50px" height="50px" />
48-
<div className="flex flex-1 flex-col justify-center">
49-
<p className="whitespace-nowrap text-left text-lg">{name}</p>
50-
{rollUpName && (
51-
<p className="min-h-[1rem] max-w-[60vw] whitespace-nowrap text-left text-gray-500 text-sm">
52-
{lastMessage}
53-
</p>
54-
)}
55-
</div>
5656
</div>
57-
<ActionMenu
58-
onAccept={onAccept}
59-
onReject={onReject}
60-
onCancel={onCancel}
61-
id={id}
62-
/>
57+
<div className="ml-4 flex flex-col justify-center">
58+
<span className="truncate font-medium text-base">{name}</span>
59+
{rollUpName && (
60+
<span className="max-w-[60vw] truncate text-gray-500 text-sm">
61+
{lastMessage}
62+
</span>
63+
)}
64+
</div>
6365
</button>
64-
65-
{/* TODO: button の中に移す */}
66-
{hasDots && (
67-
<div className="absolute top-[50%] right-4 translate-y-[-50%]">
66+
<div className="flex items-center space-x-2">
67+
{onAccept && (
68+
// biome-ignore lint/a11y/useButtonType: <explanation>
69+
<button
70+
className="btn btn-success btn-sm"
71+
onClick={() => onAccept(id)}
72+
>
73+
承認
74+
</button>
75+
)}
76+
{onReject && (
77+
// biome-ignore lint/a11y/useButtonType: <explanation>
78+
<button className="btn btn-error btn-sm" onClick={() => onReject(id)}>
79+
拒否
80+
</button>
81+
)}
82+
{onCancel && (
83+
// biome-ignore lint/a11y/useButtonType: <explanation>
84+
<button
85+
className="btn btn-secondary btn-sm"
86+
onClick={() => onCancel(id)}
87+
>
88+
キャンセル
89+
</button>
90+
)}
91+
{hasDots && (
6892
<Dots
6993
actions={[
7094
{
@@ -86,52 +110,8 @@ export function HumanListItem(props: HumanListItemProps) {
86110
},
87111
]}
88112
/>
89-
</div>
90-
)}
91-
</li>
92-
);
93-
}
94-
95-
function ActionMenu({
96-
onAccept,
97-
onReject,
98-
onCancel,
99-
id,
100-
}: {
101-
onAccept?: (id: number) => void;
102-
onReject?: (id: number) => void;
103-
onCancel?: (id: number) => void;
104-
id: number;
105-
}) {
106-
return (
107-
<div className="flex items-center gap-2">
108-
{onAccept && (
109-
<button
110-
type="button"
111-
onClick={() => onAccept(id)}
112-
className="btn btn-sm btn-primary"
113-
>
114-
承認
115-
</button>
116-
)}
117-
{onReject && (
118-
<button
119-
type="button"
120-
onClick={() => onReject(id)}
121-
className="btn btn-sm btn-outline btn-primary"
122-
>
123-
拒否
124-
</button>
125-
)}
126-
{onCancel && (
127-
<button
128-
type="button"
129-
onClick={() => onCancel(id)}
130-
className="btn btn-sm btn-outline btn-primary"
131-
>
132-
キャンセル
133-
</button>
134-
)}
113+
)}
114+
</div>
135115
</div>
136116
);
137117
}

0 commit comments

Comments
 (0)