Skip to content

Commit d224d6c

Browse files
authored
Merge pull request #146 from imaginer-dev/138-초대회원을-멤버에-추가할-수-있다
138 초대회원을 멤버에 추가할 수 있다
2 parents 294f170 + 7e9b2f5 commit d224d6c

File tree

9 files changed

+107
-21
lines changed

9 files changed

+107
-21
lines changed

src/assets/icons/IconClose.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { FC } from 'react';
2+
3+
interface Props {
4+
style: string;
5+
}
6+
7+
const IconClose: FC<Props> = ({ style }) => {
8+
return (
9+
<svg
10+
xmlns="http://www.w3.org/2000/svg"
11+
fill="none"
12+
viewBox="0 0 24 24"
13+
strokeWidth="1.5"
14+
stroke="currentColor"
15+
className={`h-6 w-6 ${style}`}
16+
>
17+
<path strokeLinecap="round" strokeLinejoin="round" d="M6 18 18 6M6 6l12 12" />
18+
</svg>
19+
);
20+
};
21+
22+
export default IconClose;

src/assets/icons/IconLeaf.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const IconLeaf = () => {
2+
return (
3+
<svg width="46" height="48" viewBox="0 0 46 48" fill="none" xmlns="http://www.w3.org/2000/svg">
4+
<path
5+
d="M38.3476 42.3332C35.985 42.3332 33.3148 42.3332 30.3858 42.5167C22.9579 42.9754 12.9085 42.165 10.8371 32.1346C7.89185 17.8842 16.4363 6.20248 15.5463 9.04646C8.2155 32.3946 21.7118 37.9143 32.6028 40.7736C35.8879 41.6298 37.7327 41.8286 40.6294 37.5626C44.3514 32.1041 47.7012 21.9055 45.0472 16.9209C39.529 6.66119 19.0093 5.42268 20.2392 1.06498C21.6471 -3.88904 -1.12189 8.74065 0.0432616 32.7004C0.706751 46.3392 13.5234 52.1648 36.082 44.7643C38.3638 44.0151 38.3476 42.3485 38.3476 42.3485V42.3332Z"
6+
fill="#B8EA00"
7+
/>
8+
</svg>
9+
);
10+
};
11+
12+
export default IconLeaf;

src/assets/icons/index.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import IconClose from './IconClose';
2+
import IconLeaf from './IconLeaf';
3+
import IconPlus from './IconPlus';
4+
import IconSearch from './IconSearch';
5+
import IconUserPlus from './IconUserPlus';
6+
7+
export { IconClose, IconLeaf, IconPlus, IconSearch, IconUserPlus };
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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ const router = createBrowserRouter([
2323
</ProtectedRoute>
2424
),
2525
},
26-
26+
{
27+
path: 'userInvite',
28+
element: <UserInvite />,
29+
},
2730
{
2831
path: '/login',
2932
element: <LoginPage />,

src/styles/index.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
border: 1px solid oklch(var(--b3));
1313
border-radius: 0.5rem;
1414
}
15+
.userInvite svg {
16+
margin: auto;
1517

1618
@media (min-width: 1024px) {
1719
.drawer-toggle {

0 commit comments

Comments
 (0)