Skip to content

Commit

Permalink
object-shorthand
Browse files Browse the repository at this point in the history
  • Loading branch information
Enya committed Aug 17, 2023
1 parent 36bcbf9 commit 9bc01e0
Showing 1 changed file with 45 additions and 49 deletions.
94 changes: 45 additions & 49 deletions packages/frontend/js/components/RoomList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ const RoomList = () => {
setNewRoom({
...newRoom,
[e.target.name]: e.target.value,
// eslint-disable-next-line object-shorthand
userName: userName,
// eslint-disable-next-line object-shorthand
userImage: userImage
userName,
userImage
})
}
const navigate = useNavigate()
Expand All @@ -66,44 +64,6 @@ const RoomList = () => {
setErrorText('連線發生錯誤')
})
}
const modalContent = (
<form className='createRoom'>
<div>
<label htmlFor='roomName' className='f-24-b'>
房間名稱:
</label>
<input
id='roomName'
type='text'
name='roomName'
value={newRoom.roomName}
onChange={(e) => handleRoomNameChange(e)}
placeholder='輸入房間名稱'
className='main_input'
/>
</div>

<div className='button_group'>
<button
className='cancel-btn'
onClick={() => {
showModal()
}}
>
取消
</button>
<button
className='blue-btn'
type='submit'
onClick={(event) => {
handleSubmitRoomName(event)
}}
>
創建房間
</button>
</div>
</form>
)

return (
<div className='room-list'>
Expand All @@ -112,12 +72,7 @@ const RoomList = () => {
<img className='avatar' />
<span className='name'>王老先生</span>
</div>
<div
className='navbar__btn'
onClick={() => {
showModal()
}}
>
<div className='navbar__btn' onClick={showModal}>
<span className='cross-btn'></span>
<span className='text'>創建房間</span>
</div>
Expand All @@ -142,7 +97,48 @@ const RoomList = () => {
<div className='row__list'>
<Pagination className='row__pagination' current={10} totalPage={20} />
</div>
<Modal isModalOpen={isModalOpen} modalContent={modalContent}></Modal>
<Modal
isModalOpen={true}
title={null}
footer={
<div className='button_group'>
<button
className='cancel-btn'
onClick={() => {
showModal()
}}
>
取消
</button>
<button
className='blue-btn'
type='submit'
onClick={(event) => {
handleSubmitRoomName(event)
}}
>
創建房間
</button>
</div>
}
>
<form>
<div>
<label htmlFor='roomName' className='f-24-b'>
房間名稱:
</label>
<input
id='roomName'
type='text'
name='roomName'
value={newRoom.roomName}
onChange={(e) => handleRoomNameChange(e)}
placeholder='輸入房間名稱'
className='main_input'
/>
</div>
</form>
</Modal>
<ErrorModal
isErrorVisible={isErrorVisible}
onClose={() => setIsErrorVisible(false)}
Expand Down

0 comments on commit 9bc01e0

Please sign in to comment.