-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Feature/#47/team] 팀원 검색 컴포넌트
- Loading branch information
Showing
25 changed files
with
577 additions
and
152 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { getUserListResponseType } from "api-models" | ||
|
||
import { baseInstance } from "../axiosInstance" | ||
|
||
export const getUserListByNickname = async (keyword: string) => { | ||
const { data } = await baseInstance.get<getUserListResponseType>( | ||
`/api/v1/users/nickname?keyword=${keyword}`, | ||
) | ||
return data | ||
} |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
import { Box } from "@chakra-ui/react" | ||
|
||
import ProjectForm from "./components/ProjectForm" | ||
|
||
const ProjectEditPage = () => { | ||
return <div>ProjectEditPage</div> | ||
return ( | ||
<Box padding="3rem"> | ||
<ProjectForm /> | ||
</Box> | ||
) | ||
} | ||
|
||
export default ProjectEditPage |
41 changes: 41 additions & 0 deletions
41
src/pages/ProjectEditPage/components/Files/FileUploadBox.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,41 @@ | ||
import { forwardRef } from "react" | ||
import { DropzoneInputProps } from "react-dropzone" | ||
import { IoCameraOutline } from "react-icons/io5" | ||
|
||
import { Center, FormLabel, Text } from "@chakra-ui/react" | ||
|
||
interface FileUploadBoxProps extends DropzoneInputProps { | ||
id: string | ||
placeholder: string | ||
boxSize?: string | number | ||
backgroundColor?: string | ||
} | ||
|
||
const FileUploadBox = forwardRef<HTMLInputElement, FileUploadBoxProps>( | ||
({ id, placeholder, boxSize, backgroundColor, ...props }, ref) => { | ||
return ( | ||
<Center | ||
bgColor={backgroundColor || "grey.300"} | ||
boxSize={boxSize}> | ||
<FormLabel htmlFor={id}> | ||
<Center | ||
flexDir="column" | ||
cursor="pointer"> | ||
<IoCameraOutline size="3rem" /> | ||
<Text>{placeholder}</Text> | ||
</Center> | ||
</FormLabel> | ||
<input | ||
type="file" | ||
id={id} | ||
ref={ref} | ||
{...props} | ||
/> | ||
</Center> | ||
) | ||
}, | ||
) | ||
|
||
FileUploadBox.displayName = "FileUploadBox" | ||
|
||
export default FileUploadBox |
34 changes: 34 additions & 0 deletions
34
src/pages/ProjectEditPage/components/Files/FileUploadSection.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,34 @@ | ||
import { ReactNode } from "react" | ||
import { | ||
DropzoneInputProps, | ||
DropzoneOptions, | ||
useDropzone, | ||
} from "react-dropzone" | ||
|
||
import { Box } from "@chakra-ui/react" | ||
|
||
interface FileUploadAreaProps extends DropzoneOptions { | ||
children: (props: DropzoneInputProps) => ReactNode | ||
} | ||
|
||
const FileUploadSection = ({ | ||
onDrop, | ||
accept, | ||
children, | ||
...props | ||
}: FileUploadAreaProps) => { | ||
const { getRootProps, getInputProps } = useDropzone({ | ||
onDrop, | ||
accept, | ||
...props, | ||
}) | ||
return ( | ||
<Box | ||
{...getRootProps()} | ||
aria-label="File-Upload"> | ||
{children(getInputProps())} | ||
</Box> | ||
) | ||
} | ||
|
||
export default FileUploadSection |
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 FileUploadBox from "@pages/ProjectEditPage/components/Files/FileUploadBox" | ||
import { useFileUpload } from "@pages/ProjectEditPage/hooks/useFileUpload" | ||
import { useProjectFormContext } from "@pages/ProjectEditPage/hooks/useProjectFormContext" | ||
|
||
import FileUploadSection from "./FileUploadSection" | ||
|
||
const Overview = () => { | ||
const MAX_FILE_UPLOAD = 6 | ||
const { getValues, setValue, watch } = useProjectFormContext() | ||
const { onChangeFile } = useFileUpload() | ||
|
||
console.log(watch("overviewImageUrl")) | ||
|
||
const onDropFile = async (files: File[]) => { | ||
const prevImageUrls = getValues("overviewImageUrl") | ||
if ( | ||
prevImageUrls && | ||
prevImageUrls.length + files.length > Number(`${MAX_FILE_UPLOAD}`) | ||
) { | ||
alert("최대 6개까지 업로드 가능합니다") | ||
return | ||
} | ||
const fileUrls = await onChangeFile(files) | ||
if (!fileUrls.length) { | ||
return | ||
} | ||
setValue("overviewImageUrl", [...prevImageUrls, ...fileUrls]) | ||
} | ||
|
||
return ( | ||
<> | ||
<FileUploadSection | ||
onDrop={onDropFile} | ||
maxFiles={6} | ||
disabled={ | ||
getValues("overviewImageUrl").length >= Number(`${MAX_FILE_UPLOAD}`) | ||
} | ||
multiple={true} | ||
accept={{ "image/*": [".jpeg", ".png"] }}> | ||
{(inputProps) => ( | ||
<FileUploadBox | ||
{...inputProps} | ||
id="overviewImageUrl" | ||
placeholder="최대 6개까지 업로드 가능합니다" | ||
/> | ||
)} | ||
</FileUploadSection> | ||
</> | ||
) | ||
} | ||
|
||
export default Overview |
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,45 @@ | ||
import { Box, Img } from "@chakra-ui/react" | ||
|
||
import FileUploadBox from "@pages/ProjectEditPage/components/Files/FileUploadBox" | ||
import { useFileUpload } from "@pages/ProjectEditPage/hooks/useFileUpload" | ||
import { useProjectFormContext } from "@pages/ProjectEditPage/hooks/useProjectFormContext" | ||
|
||
import FileUploadSection from "./FileUploadSection" | ||
|
||
const Thumbnail = () => { | ||
const { getValues, setValue, watch } = useProjectFormContext() | ||
const { onChangeFile } = useFileUpload() | ||
|
||
const onDropFile = async (file: File[]) => { | ||
const fileUrls = await onChangeFile(file) | ||
if (!fileUrls.length) { | ||
return | ||
} | ||
setValue("thumbnailUrl", fileUrls[0]) | ||
} | ||
|
||
console.log(watch("thumbnailUrl")) | ||
|
||
return ( | ||
<> | ||
<FileUploadSection | ||
onDrop={onDropFile} | ||
maxFiles={1} | ||
multiple={false} | ||
accept={{ "image/*": [".jpeg", ".png"] }}> | ||
{(inputProps) => ( | ||
<FileUploadBox | ||
{...inputProps} | ||
id="thumbnail" | ||
placeholder="대표 사진을 업로드해주세요" | ||
/> | ||
)} | ||
</FileUploadSection> | ||
<Box> | ||
<Img src={getValues("thumbnailUrl")} /> | ||
</Box> | ||
</> | ||
) | ||
} | ||
|
||
export default Thumbnail |
Oops, something went wrong.