Skip to content

Commit

Permalink
Merge pull request #64 from AnWhiteM/column-modals
Browse files Browse the repository at this point in the history
Fix ColumnModalBtn
  • Loading branch information
AnWhiteM authored Jun 14, 2024
2 parents 7de830d + 89b911d commit 1d12714
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/components/AddAnotherCardBtn/AddAnotherCardBtn.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export const AddAnotherCardBtn = () => {
</div>
Add another card
</button>
{createCardModal &&
<CreateCard isOpen={createCardModal} isClose={closeModal} />}
{createCardModal && (
<CreateCard isOpen={createCardModal} isClose={closeModal} />)}
</div>
);
};
14 changes: 8 additions & 6 deletions src/components/AddColumnBtn/AddColumnBtn.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,27 @@ import { useState } from "react";
export const AddColumnBtn = () => {
const [isOpen, setIsOpen] = useState(false);

function openColumnCreateModal() {
const openModal = () => {
setIsOpen(true)
}

function closeColumnCreateModal() {
const closeModal = () => {
setIsOpen(false)
}

return (
<div className={css.btn} onClick={openColumnCreateModal}>
<>
<button onClick={openModal} className={css.openModalBtn}>
<div className={css.iconBox}>
<svg className={css.icon} width="14px" height="14px">
<use href={svg + "#icon-plus"}></use>
</svg>
</div>
<p className={css.text}>Add another column</p>
</button>
{isOpen && (
<CreateColumn isOpen={isOpen} isClose={closeColumnCreateModal} />
<CreateColumn isOpen={isOpen} isClose={closeModal} />
)}
</div>
</>
);
};
13 changes: 7 additions & 6 deletions src/components/AddColumnBtn/AddColumnBtn.module.css
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
.btn {
padding: 14px 78px;
background-color: #121212;
border-radius: 8px;
border: none;
.openModalBtn {
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
max-width: 335px;
gap: 8px;
border: none;
border-radius: 8px;
background: #121212;
min-width: 334px;
height: 56px;
}

.iconBox {
Expand All @@ -26,6 +26,7 @@
font-size: 14px;
letter-spacing: -0.02em;
color: #fff;
width: 141px;
}

.icon {
Expand Down
3 changes: 1 addition & 2 deletions src/components/CreateColumnModal/CreateColumnModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export const CreateColumn = ({ isOpen, isClose }) => {
columnname: Yup.string().min(3, 'Too short!').max(20, 'Too long!').required('Required!')
});


return (
<>
<Modal isOpen={isOpen} onRequestClose={() => isClose()} className={css.createColumnModal} overlayClassName={css.createColumnModalOverlay}>
Expand All @@ -30,7 +29,7 @@ export const CreateColumn = ({ isOpen, isClose }) => {
>
<Form autoComplete="off" className={css.createColumnModalForm}>
<Field type='text' name='columnname' className={css.createColumnModalInput} placeholder="Title" />
<button type="submit" className={css.createColumnModalSubmit} onClick={() => isClose()}>
<button type="submit" className={css.createColumnModalSubmit} onClick={isClose}>
<span className={css.createColumnModalSpan}>
<svg className={css.createColumnModalAddIcon} width="14px" height="14px">
<use href={svg + "#icon-plus"}></use>
Expand Down
8 changes: 5 additions & 3 deletions src/components/EditColumnModal/EditColumnModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const EditColumn = ({ isOpen, isClose, title }) => {
return (
<>
<Modal isOpen={isOpen} onRequestClose={() => isClose()} className={css.editColumnModal} overlayClassName={css.editColumnModalOverlay}>
<button className={css.editColumnModalCloseBtn} type="button" onClick={isClose}>
<button className={css.editColumnModalCloseBtn} type="button" onClick={() => isClose()}>
<svg className={css.editColumnModalIcon} width="18px" height="18px">
<use href={svg + "#x-close"}></use>
</svg>
Expand All @@ -26,11 +26,13 @@ export const EditColumn = ({ isOpen, isClose, title }) => {
initialValues={{ columnname: title }}
validationSchema={columnModalValidation}
portalClassName="createColumnModalContainer"
// onSubmit={(values, actions) => {}}
onSubmit={(values, actions) => {
isClose()
}}
>
<Form autoComplete="off" className={css.editColumnModalForm}>
<Field type='text' name='columnname' className={css.editColumnModalInput} placeholder="Title" />
<button type="submit" className={css.editColumnModalSubmit} onClick={() => isClose()}>
<button type="submit" className={css.editColumnModalSubmit}>
<span className={css.editColumnModalSpan}>
<svg className={css.editColumnModalAddIcon} width="14px" height="14px">
<use href={svg + "#icon-plus"}></use>
Expand Down
6 changes: 4 additions & 2 deletions src/components/MainDashboard/MainDashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ export const MainDashboard = () => {
return (
<div className={css.container}>
{/* <DashboardMessage /> */}
{/* <AddColumnBtn/> */}
<TaskColumn />
<div className={css.dashContainer}>
<TaskColumn />
<AddColumnBtn/>
</div>
</div>
);
};
6 changes: 6 additions & 0 deletions src/components/MainDashboard/MainDashboard.module.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
.container {
background-color: #1F1F1F;
min-height: 85vh;
}

.dashContainer {
background-color: #1F1F1F;
display: flex;
min-height: 85vh;
}

0 comments on commit 1d12714

Please sign in to comment.