Skip to content

Commit

Permalink
[feat] boostcampwm-2022#66 boostcampwm-2022#85 친구 목록 전역으로 관리
Browse files Browse the repository at this point in the history
- drop 되었을 때, 전역 정보 수정 (탭 간 이동해도 목록 유지)
  • Loading branch information
ktmihs committed Dec 1, 2022
1 parent c2e8ba7 commit b992b8c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions frontend/src/component/Sidebar/Friends/callingList.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { MouseEvent } from 'react';
import { useRecoilValue } from 'recoil';
import { useRecoilState } from 'recoil';
import { friendsState } from '../../../store/atom/friends';
import Content from '../Content';
import FriendItem from './friendItem';
import { friendType } from './friends';
import { callingList } from './friends.styled';

const CallingList = () => {
const friends = useRecoilValue(friendsState);
const [friends, setFriends] = useRecoilState(friendsState);
const friendList = Object.values(friends).filter(value => value.isCalling);

const handleDragOver = (e: MouseEvent) => {
Expand All @@ -19,7 +19,15 @@ const CallingList = () => {

if (target.tagName !== 'UL' || !draggingElement) return;

target.appendChild(draggingElement);
const id = draggingElement.children[0].id;

setFriends({
...friends,
[id]: {
...friends[id],
isCalling: true,
},
});
};

return (
Expand Down

0 comments on commit b992b8c

Please sign in to comment.