Skip to content
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

Feature/#360 학습자료 수정 시 파일 유형 및 추가 UI 제거 #362

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 55 additions & 57 deletions src/containers/study/CreateDocumentModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,49 +249,45 @@ const CreateDocumentModal = ({ isOpen, onClose, categoryData, category }: Docume
}
value={description}
/>
<StyledRadioGroup
title="파일 유형"
value={category === 'create' ? doctype : (categoryData as DocumentDetail).type}
onChange={category === 'create' ? (v) => setDocType(v as DocumentType) : () => {}}
>
<StyledRadio value="IMAGE">이미지</StyledRadio>
<StyledRadio value="DOCUMENT">파일</StyledRadio>
<StyledRadio value="URL">URL 링크</StyledRadio>
</StyledRadioGroup>
<Flex justify="end" direction="row" gap="4" shrink="0">
<Input
ref={urlInputRef}
flex="1"
h="7"
shadow="md"
hidden={doctype !== 'URL'}
placeholder="URL 링크를 입력해주세요."
/>
<Button
w="28"
h="7"
shadow="md"
onClick={category === 'create' ? () => handleAddDoc[doctype]() : () => {}}
variant="orange"
>
추가하기
</Button>
</Flex>
<Divider borderWidth="2px" borderColor={color.orange_dark} />
<input
hidden
type="file"
multiple
accept="image/jpg,image/png,image/jpeg,image/gif"
ref={imgInputRef}
onChange={handleGetDoc.IMAGE}
/>
<input
hidden
type="file"
multiple
ref={fileInputRef}
accept="text/plain,
{category === 'create' && (
<>
<StyledRadioGroup
title="파일 유형"
value={category === 'create' ? doctype : (categoryData as DocumentDetail).type}
onChange={category === 'create' ? (v) => setDocType(v as DocumentType) : () => {}}
>
<StyledRadio value="IMAGE">이미지</StyledRadio>
<StyledRadio value="DOCUMENT">파일</StyledRadio>
<StyledRadio value="URL">URL 링크</StyledRadio>
</StyledRadioGroup>
<Flex justify="end" direction="row" gap="4" shrink="0">
<Input
ref={urlInputRef}
flex="1"
h="7"
shadow="md"
hidden={doctype !== 'URL'}
placeholder="URL 링크를 입력해주세요."
/>
<Button w="28" h="7" shadow="md" onClick={() => handleAddDoc[doctype]()} variant="orange">
추가하기
</Button>
</Flex>
<Divider borderWidth="2px" borderColor={color.orange_dark} />
<input
hidden
type="file"
multiple
accept="image/jpg,image/png,image/jpeg,image/gif"
ref={imgInputRef}
onChange={handleGetDoc.IMAGE}
/>
<input
hidden
type="file"
multiple
ref={fileInputRef}
accept="text/plain,
application/zip,
application/pdf,
application/vnd.ms-powerpoint,
Expand All @@ -306,20 +302,22 @@ const CreateDocumentModal = ({ isOpen, onClose, categoryData, category }: Docume
image/png,
image/gif,
image/webp"
onChange={handleGetDoc.DOCUMENT}
/>
<Flex direction="column" gap="4" overflow="scroll" maxH="52" shrink="0">
{docList[doctype] &&
docList[doctype].map((doc, index) => (
<IconBox
key={doc.key}
leftIcon={DocumentBoxIcon[doctype]}
content={doc.name}
rightIcon={<BiTrash />}
handleClick={category === 'create' ? () => handleRemoveDoc(index) : () => {}}
/>
))}
</Flex>
onChange={handleGetDoc.DOCUMENT}
/>
<Flex direction="column" gap="4" overflow="scroll" maxH="52" shrink="0">
{docList[doctype] &&
docList[doctype].map((doc, index) => (
<IconBox
key={doc.key}
leftIcon={DocumentBoxIcon[doctype]}
content={doc.name}
rightIcon={<BiTrash />}
handleClick={category === 'create' ? () => handleRemoveDoc(index) : () => {}}
/>
))}
</Flex>
</>
)}
<StyledRadioGroup
title="공개 범위"
defaultValue={category === 'create' ? 'ALL' : (categoryData as DocumentDetail).accessType}
Expand Down