-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from DDD-Community/feature/103
[Feature/103] 마이페이지, 내 보드 목록 페이지
- Loading branch information
Showing
15 changed files
with
223 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
src/app/mypage/boards/_components/BoardList/ChangeBoardNameModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import Modal from '@/components/Modal' | ||
import TextInput from '@/components/TextInput' | ||
import { changeMyBoardName } from '@/lib' | ||
import ClipIcon from 'public/icons/sketchIcons-paperclip.svg' | ||
import { useState } from 'react' | ||
|
||
const MAX_BOARD_NAME_LENGTH = 15 | ||
|
||
interface ChangeBoardNameModalProps { | ||
isOpen: boolean | ||
onClose: () => void | ||
oldName: string | ||
boardId: string | ||
onRefresh: () => void | ||
} | ||
|
||
const ChangeBoardNameModal = ({ | ||
isOpen, | ||
onClose, | ||
oldName, | ||
boardId, | ||
onRefresh, | ||
}: ChangeBoardNameModalProps) => { | ||
const [title, setTitle] = useState(oldName) | ||
const [hasError, setHasError] = useState(false) | ||
const isEmpty = title.length === 0 | ||
|
||
const onInput = (value: string) => { | ||
setTitle(value) | ||
if (value.length > MAX_BOARD_NAME_LENGTH) { | ||
setHasError(true) | ||
} else { | ||
setHasError(false) | ||
} | ||
} | ||
|
||
const changeBoardName = async (id: string) => { | ||
await changeMyBoardName(id, title) | ||
onRefresh() | ||
} | ||
|
||
return ( | ||
<Modal isOpen={isOpen} onClose={onClose}> | ||
<Modal.CenterModal icon={<ClipIcon className="scale-[2.5]" />}> | ||
<Modal.Close /> | ||
<Modal.Title>보드 주제 수정</Modal.Title> | ||
<div className="mt-3"> | ||
<TextInput | ||
errorMessage={`${MAX_BOARD_NAME_LENGTH}자 이내로 입력 가능해요`} | ||
description={`${title.length}/${MAX_BOARD_NAME_LENGTH}자`} | ||
value={title} | ||
hasError={hasError} | ||
setValue={onInput} | ||
icon={null} | ||
/> | ||
</div> | ||
<Modal.CenterConfirm | ||
confirmText="확인" | ||
disabled={hasError || isEmpty} | ||
onConfirm={() => changeBoardName(boardId)} | ||
/> | ||
</Modal.CenterModal> | ||
</Modal> | ||
) | ||
} | ||
|
||
export default ChangeBoardNameModal |
52 changes: 52 additions & 0 deletions
52
src/app/mypage/boards/_components/BoardList/FilterTabBar.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { createQueryString } from '@/lib/utils/query' | ||
import { usePathname, useRouter, useSearchParams } from 'next/navigation' | ||
import { useCallback } from 'react' | ||
import { twMerge } from 'tailwind-merge' | ||
|
||
const FilterTabBar = () => { | ||
const router = useRouter() | ||
const pathname = usePathname() | ||
const searchParams = useSearchParams() | ||
|
||
const createQueryStringCallback = useCallback( | ||
(name: string, value: string) => { | ||
return createQueryString(searchParams, name, value) | ||
}, | ||
[searchParams], | ||
) | ||
const isParticipant = searchParams.get('participant') === 'true' | ||
|
||
const selectedStyle = 'bg-gray-800 font-semiBold text-gray-0' | ||
const unselectedStyle = 'text-gray-600 border border-gray-500' | ||
|
||
return ( | ||
<div className="mx-7 mt-3 flex"> | ||
<button | ||
type="button" | ||
onClick={() => router.replace(pathname)} | ||
className={twMerge( | ||
'w-1/2 rounded-l-lg py-2.5 text-center text-sm', | ||
isParticipant ? unselectedStyle : selectedStyle, | ||
)} | ||
> | ||
내가 만든 보드 | ||
</button> | ||
<button | ||
type="button" | ||
onClick={() => | ||
router.replace( | ||
`${pathname}?${createQueryStringCallback('participant', 'true')}`, | ||
) | ||
} | ||
className={twMerge( | ||
'w-1/2 rounded-r-lg py-2.5 text-center text-sm', | ||
isParticipant ? selectedStyle : unselectedStyle, | ||
)} | ||
> | ||
내가 참여한 보드 | ||
</button> | ||
</div> | ||
) | ||
} | ||
|
||
export default FilterTabBar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.