-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 업로드 페이지 저작권자 검색, 정산 비율 배열 추가 #98
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
지현이누나 코드랑 같은거야?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
컴포넌트 분리해줘
const [state, setState] = React.useState({ | ||
bottom: false, | ||
}); | ||
|
||
const anchor = 'bottom'; | ||
|
||
const toggleDrawer = (anchor, open) => (event) => { | ||
handleOnClick(); | ||
|
||
if (event.type === 'keydown' && (event.key === 'Tab' || event.key === 'Shift')) { | ||
return; | ||
} | ||
setState({ ...state, [anchor]: open }); | ||
}; | ||
|
||
// const Navigate = useNavigate(); | ||
const [holder, setholder] = useState([]); | ||
const holderlist = (item) => { | ||
setholder((holder) => { | ||
console.log(holder); | ||
return [...holder, item]; | ||
}); | ||
}; | ||
const list = (anchor) => ( | ||
<Box | ||
style={{ fontColor: 'red' }} | ||
sx={{ width: anchor === 'top' || anchor === 'bottom' ? 'auto' : 250 }} | ||
role="presentation" | ||
onClick={toggleDrawer(anchor, false)} | ||
onKeyDown={toggleDrawer(anchor, false)} | ||
> | ||
<List> | ||
{data.map((item) => ( | ||
<ListItem style={{ color: 'Black' }} key={item.id}> | ||
<ListItemButton onClick={() => holderlist(item.id)}> | ||
<ListItemText primary={item.nickname} /> | ||
</ListItemButton> | ||
</ListItem> | ||
))} | ||
</List> | ||
<Divider /> | ||
</Box> | ||
); | ||
|
||
const [data, setData] = useState([]); | ||
|
||
const token = localStorage.getItem('jwtToken'); | ||
|
||
const [search, setSearch] = useState(''); | ||
|
||
const [copyright, setcopyright] = useState([]); | ||
|
||
const copyrightlist = (e) => { | ||
setcopyright((copyright) => { | ||
return [...copyright, e.target.value]; | ||
}); | ||
}; | ||
|
||
const handleOnKeyPress = (e) => { | ||
if (e.key == ' ') { | ||
copyrightlist(e); | ||
} | ||
}; | ||
|
||
const onChangeSearch = (e) => { | ||
setSearch(e.target.value); | ||
toggleDrawer(anchor, true); | ||
}; | ||
|
||
const handleOnClick = async () => { | ||
// console.log(token); | ||
|
||
await axios | ||
.get(`http://${process.env.REACT_APP_BACKEND_URL}/api/v1/user?search=${search}`, { | ||
headers: { | ||
authorization: token, | ||
}, | ||
params: { | ||
holder, | ||
}, | ||
}) | ||
.then((res) => { | ||
setData(res.data.data); | ||
console.log(data); | ||
console.log(search); | ||
console.log(holder); | ||
console.log(copyright); | ||
}) | ||
.catch((err) => { | ||
console.log(err); | ||
}); | ||
}; | ||
|
||
return ( | ||
<DetailDiv> | ||
{props.countComposerList && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
컴포넌트 분리 할것
const [state, setState] = React.useState({ | ||
bottom: false, | ||
}); | ||
|
||
const anchor = 'bottom'; | ||
|
||
const toggleDrawer = (anchor, open) => (event) => { | ||
handleOnClick(); | ||
if (event.type === 'keydown' && (event.key === 'Tab' || event.key === 'Shift')) { | ||
return; | ||
} | ||
setState({ ...state, [anchor]: open }); | ||
}; | ||
const [holder2, setholder2] = useState([]); | ||
const holderlist2 = (item) => { | ||
setholder2((holder2) => { | ||
console.log(holder2); | ||
return [...holder2, item]; | ||
}); | ||
}; | ||
|
||
const list = (anchor) => ( | ||
<Box | ||
sx={{ width: anchor === 'top' || anchor === 'bottom' ? 'auto' : 250 }} | ||
role="presentation" | ||
onClick={toggleDrawer(anchor, false)} | ||
onKeyDown={toggleDrawer(anchor, false)} | ||
> | ||
<List> | ||
{data.map((item) => ( | ||
<ListItem style={{ color: 'Black' }} key={item.id}> | ||
<ListItemButton onClick={() => holderlist2(item.id)}> | ||
<ListItemText primary={item.nickname}></ListItemText> | ||
</ListItemButton> | ||
</ListItem> | ||
))} | ||
</List> | ||
<Divider /> | ||
</Box> | ||
); | ||
|
||
const [data, setData] = useState([]); | ||
|
||
const token = localStorage.getItem('jwtToken'); | ||
|
||
const [search, setSearch] = useState(''); | ||
const [copyright2, setcopyright2] = useState([]); | ||
|
||
const copyrightlist2 = (e) => { | ||
setcopyright2((copyright2) => { | ||
return [...copyright2, e.target.value]; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
드레그 빡세네 이것도 컴포넌트 분리
주요 변경 사항
코드 설명
중요도
기타 특이사항