-
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.
added delete board and task functionality
- Loading branch information
1 parent
5e49e16
commit 4030028
Showing
7 changed files
with
148 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import React from 'react' | ||
|
||
import useStore from '../store/store' | ||
import Button from '../ui/Button' | ||
import '../../sass/shared/delete.scss' | ||
|
||
const Delete: React.FC<{ isBoard: boolean }> = function ({ isBoard }) { | ||
const [ | ||
modalType, | ||
setModalType, | ||
currentBoard, | ||
theme, | ||
deleteBoard, | ||
deleteTask, | ||
] = useStore(state => [ | ||
state.modalType, | ||
state.setModalType, | ||
state.currentBoard, | ||
state.theme(), | ||
state.deleteBoard, | ||
state.deleteTask, | ||
]) | ||
|
||
return ( | ||
<div className="delete" data-theme={theme}> | ||
<p className="delete__header"> | ||
Delete this {isBoard ? 'board' : 'task'}? | ||
</p> | ||
<p className="delete__message"> | ||
{isBoard | ||
? `Are you sure you want to delete the ‘${ | ||
currentBoard().name | ||
}’ board? This action will remove all columns and tasks and cannot be reversed.` | ||
: `Are you sure you want to delete the ‘${modalType.modalInfo?.name}’ task and its subtasks? This action cannot be reversed.`} | ||
</p> | ||
<div className="delete__btn-container"> | ||
<Button | ||
className="del" | ||
onClick={() => | ||
isBoard | ||
? deleteBoard(currentBoard().id) | ||
: deleteTask(currentBoard().id, modalType.modalInfo!.id) | ||
} | ||
> | ||
Delete | ||
</Button> | ||
<Button | ||
className=" del del--cancel" | ||
onClick={() => setModalType({ modalType: '', showModal: false })} | ||
> | ||
Cancel | ||
</Button> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default Delete |
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
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,46 @@ | ||
@use '../variables' as *; | ||
|
||
.delete { | ||
width: min(95%, 480px); | ||
background-color: $white; | ||
border-radius: 6px; | ||
padding: $spacer * 1.5; | ||
margin-inline: auto; | ||
|
||
&__header { | ||
color: $red-200; | ||
font-weight: 700; | ||
font-size: 1.1rem; | ||
} | ||
&__message { | ||
margin-block: $spacer $spacer * 1.5; | ||
color: $gray-200; | ||
line-height: 25px; | ||
font-weight: 500; | ||
} | ||
|
||
&__btn-container { | ||
display: flex; | ||
gap: $spacer; | ||
|
||
.del { | ||
flex: 1; | ||
display: block; | ||
text-align: center; | ||
background-color: $red-200; | ||
|
||
&--cancel { | ||
background-color: rgba(99, 95, 199, 0.1); | ||
color: $purple-main; | ||
} | ||
} | ||
} | ||
|
||
&[data-theme='dark'] { | ||
background-color: $dark-200; | ||
|
||
.del--cancel { | ||
background-color: $white; | ||
} | ||
} | ||
} |