Skip to content

Commit

Permalink
feat: 1. 폴더삭제모달 완료 2. 폴더 이름 변경 모달 수정 (현재폴더명 출력)
Browse files Browse the repository at this point in the history
  • Loading branch information
전유민 committed Apr 28, 2024
1 parent de808b1 commit d1a718c
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/components/Modals/AddFolderModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const AddFolderModal = ({
isOpen,
title,
placeholder,
description,
buttonText,
onCloseClick,
onKeyDown,
Expand All @@ -19,6 +20,7 @@ export const AddFolderModal = ({
title={
<S.ModalTitle>
<h2>{title}</h2>
<p>{description}</p>
</S.ModalTitle>
}
content={
Expand Down
32 changes: 32 additions & 0 deletions src/components/Modals/DeleteModal.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Modal } from "../Modal/Modal";
import { ModalContentBox } from "../Modal/ModalContentBox";

import * as S from "./Modals.style";

export const DeleteModal = ({
isOpen,
title,
description,
buttonText,
onCloseClick,
onKeyDown,
}) => {
return (
<Modal isOpen={isOpen} onCloseClick={onCloseClick} onKeyDown={onKeyDown}>
<ModalContentBox
title={
<S.ModalTitle>
<h2>{title}</h2>
<p>{description}</p>
</S.ModalTitle>
}
content={
<S.ModalContent>
<button className="btn-primary red">{buttonText}</button>
</S.ModalContent>
}
onCloseClick={onCloseClick}
/>
</Modal>
);
};
25 changes: 23 additions & 2 deletions src/components/Folder/FolderToolBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ALL_LINKS_ID } from "../../api/constant";
import { ALL_LINKS_TEXT, MODALS_ID, BUTTONS } from "./constant";
import * as FolderToolBarLayout from "./FolderToolBar.style";
import { AddFolderModal } from "../\bModals/AddFolderModal";
import { DeleteModal } from "../\bModals/DeleteModal";

export const FolderToolBar = ({
folderList,
Expand Down Expand Up @@ -72,8 +73,11 @@ export const FolderToolBar = ({
{/* "전체" 일 때를 제외한 버튼 출력 */}
{selectedFolderId !== ALL_LINKS_ID && (
<FolderToolBarLayout.IconButtonWrap>
{BUTTONS.map(({ text, iconSource }, index) => (
<FolderToolBarLayout.IconButton key={index}>
{BUTTONS.map(({ text, iconSource, modalId }, index) => (
<FolderToolBarLayout.IconButton
key={index}
onClick={() => setCurrentModal(modalId)}
>
<FolderToolBarLayout.IconImage
src={iconSource}
alt={`${text} 아이콘`}
Expand All @@ -83,6 +87,23 @@ export const FolderToolBar = ({
</FolderToolBarLayout.IconText>
</FolderToolBarLayout.IconButton>
))}
<AddFolderModal
isOpen={currentModal === MODALS_ID.rename}
title="폴더 이름 변경"
placeholder="내용 입력"
description={folderName}
buttonText="변경하기"
onCloseClick={closeModal}
onKeyDown={handleKeyDown}
/>
<DeleteModal
isOpen={currentModal === MODALS_ID.delete}
title="폴더 삭제"
description={folderName}
buttonText="삭제하기"
onCloseClick={closeModal}
onKeyDown={handleKeyDown}
/>
</FolderToolBarLayout.IconButtonWrap>
)}
</FolderToolBarLayout.FolderToolBarWrap>
Expand Down
3 changes: 3 additions & 0 deletions src/components/Folder/constant.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ export const BUTTONS = [
{
iconSource: "images/icon/share.svg",
text: "공유",
modalId: MODALS_ID.share,
},
{
iconSource: "images/icon/pen.svg",
text: "이름 변경",
modalId: MODALS_ID.rename,
},
{
iconSource: "images/icon/delete.svg",
text: "삭제",
modalId: MODALS_ID.delete,
},
];
4 changes: 4 additions & 0 deletions src/styles/button.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
}
}

.btn-primary.red {
background: var(--Linkbrary-red);
}

.btn-sm {
width: 12.8rem;
}
Expand Down

0 comments on commit d1a718c

Please sign in to comment.