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

[new #56] remove items / milestones #70

Merged
merged 3 commits into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
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
14 changes: 11 additions & 3 deletions src/assets/Modal.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,33 @@ input {
padding: 5px 10px;
}

.modal-submit {
.modal-buttons {
display: flex;
justify-content: center;
gap: 25px;
margin-top: 10px;
}

.modal-submit, .modal-delete {
padding: 10px;
background-color: #fff;
border: 1px solid #333;
color: #333;
font-family: "Roboto", sans-serif;
font-size: 1rem;
transition-duration: .5s;
margin-top: 10px;
cursor: pointer;
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Old versions of Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none;
display: flex;
gap: 5px;
}

.modal-submit:hover {
.modal-submit:hover, .modal-delete:hover {
background-color: #333;
color: #fff;
}
7 changes: 6 additions & 1 deletion src/components/EditItemModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ const EditItemModal = (props) => {
let groupId = props.currentGroupId



const milestoneDateDefaultValue = {
year: milestone?.date.year(),
month: milestone?.date.month() + 1,
Expand All @@ -59,6 +58,11 @@ const EditItemModal = (props) => {
groupId = currentNode.value
}

const onDelete = () => {
props.onDelete(item, milestone, type, props.type)
}


return (
<Modal
title={props.title}
Expand All @@ -77,6 +81,7 @@ const EditItemModal = (props) => {
milestoneColor,
}, props.mode, type)
}}
onDelete={props.mode === 'edit' ? onDelete : null}
>

{props.mode === 'add' &&
Expand Down
19 changes: 15 additions & 4 deletions src/components/Modal.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import React from "react"
import {FaPlus} from 'react-icons/fa'
import {FaPlus, FaCheck, FaTrash} from 'react-icons/fa'
import './../assets/Modal.css'

export default class Modal extends React.Component {
onSubmit = () => {
this.props.onSubmit()
}

onDelete = () => {
this.props.onDelete()
}

render() {
return (
<div className="modal">
Expand All @@ -16,9 +20,16 @@ export default class Modal extends React.Component {
</div>
<div className="modal-body">
{this.props.children}
<button className="modal-submit" onClick={this.onSubmit}>
Submit
</button>
<div className="modal-buttons">
<button className="modal-submit" onClick={this.onSubmit}>
<FaCheck/> Submit
</button>
{this.props.onDelete && (
<button className="modal-delete" onClick={this.onDelete}>
<FaTrash/> Delete
</button>
)}
</div>
</div>
</div>
)
Expand Down
Loading