Skip to content

Commit a53aa5b

Browse files
committed
feat: 멤버추가 ui 및 기능 작업
1 parent 564357f commit a53aa5b

File tree

5 files changed

+61
-21
lines changed

5 files changed

+61
-21
lines changed
Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
import { FC } from 'react';
22
import DialogButton from '@/components/common/DialogButton';
3-
import IconUserPlus from '@/assets/icons/IconUserPlus';
3+
import { IconUserPlus } from '@/assets/icons';
44
import UserInviteDialog from '@/components/common/UserInviteDialog';
55

6-
const AddCalendarPage: FC = () => {
6+
export const UserInvite: FC = () => {
77
return (
88
<div>
99
멤버 초대하기 *
10-
<DialogButton
11-
classname={'userInvite bg-base-200 hover:bg-base-300'}
12-
name={<IconUserPlus />}
13-
title={'멤버 찾기'}
14-
desc={''}
15-
children={<UserInviteDialog />}
16-
/>
10+
<ul className="flex gap-2">
11+
<li>
12+
<DialogButton
13+
classname={'userInvite bg-base-200 hover:bg-base-300'}
14+
name={<IconUserPlus />}
15+
title={'멤버 찾기'}
16+
desc={''}
17+
children={<UserInviteDialog />}
18+
/>
19+
</li>
20+
</ul>
1721
</div>
1822
);
1923
};
2024

21-
export default AddCalendarPage;
25+
export default UserInvite;

src/components/common/UserInviteDialog.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import InputForm from './InputForm.tsx';
22
import { searchUser } from '../../apis/authApis.ts';
33
import { FC, useState } from 'react';
4-
import IconSearch from '@/assets/icons/IconSearch.tsx';
4+
import { IconSearch } from '@/assets/icons';
55
import UserInviteList from './UserInviteList.tsx';
66

77
const UserInvite: FC = () => {
@@ -13,8 +13,16 @@ const UserInvite: FC = () => {
1313
};
1414

1515
const onSearchClick = () => {
16-
searchUser(email).then((value) => {
17-
setList(value.map(({ user_nickname, id }) => <UserInviteList user_nickname={user_nickname} id={id} />));
16+
searchUser(email).then((nickNames) => {
17+
if (!nickNames.length) {
18+
alert('해당 닉네임을 찾을 수 없습니다.');
19+
return;
20+
}
21+
setList(
22+
nickNames.map(({ user_nickname, id }) => {
23+
return <UserInviteList user_nickname={user_nickname} id={id} />;
24+
}),
25+
);
1826
return list;
1927
});
2028
};
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
import { FC } from 'react';
2-
import IconPlus from '@/assets/icons/IconPlus.tsx';
2+
import { IconPlus } from '@/assets/icons';
33

44
interface Props {
55
user_nickname: any;
66
id: string;
77
}
88

9-
const UserPlusList: FC<Props> = ({ user_nickname, id }) => {
9+
const UserInviteList: FC<Props> = ({ user_nickname, id }) => {
1010
return (
1111
<li key={id} className="border-b">
12-
<button className="ju btn block flex w-full justify-between border-none bg-transparent" onClick={onPlusClick}>
12+
<button className="ju btn block flex w-full justify-between border-none bg-transparent" onClick={onClick}>
1313
{user_nickname}
1414
<IconPlus />
1515
</button>
1616
</li>
1717
);
1818
};
1919

20-
const onPlusClick = () => {
21-
console.log('aa');
22-
};
20+
const onClick = () => {};
2321

24-
export default UserPlusList;
22+
export default UserInviteList;
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { FC } from 'react';
2+
import { IconClose, IconLeaf } from '@/assets/icons';
3+
import DialogButton from './DialogButton';
4+
5+
interface Props {
6+
user_nickname: any;
7+
id: any;
8+
}
9+
10+
const UserInvited: FC<Props> = ({ user_nickname, id }) => {
11+
return (
12+
<li key={id}>
13+
<DialogButton
14+
classname={'userInvite bg-white hover:bg-base-100 relative'}
15+
name={
16+
<div>
17+
<IconClose style={'absolute top-px right-px'} />
18+
<IconLeaf />
19+
<p>{user_nickname}</p>
20+
</div>
21+
}
22+
title={''}
23+
desc={'해당 멤버를 삭제 하시겠습니까?'}
24+
children={''}
25+
/>
26+
</li>
27+
);
28+
};
29+
30+
export default UserInvited;

src/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const router = createBrowserRouter([
4848
element: <TextInputForm />,
4949
},
5050
{
51-
path: 'UserInvite',
51+
path: 'userInvite',
5252
element: <UserInvite />,
5353
},
5454
],

0 commit comments

Comments
 (0)