Skip to content

Commit

Permalink
Merge pull request #70 from kbss-cvut/milestones
Browse files Browse the repository at this point in the history
[new #56] remove items / milestones
  • Loading branch information
PluharVit authored Oct 10, 2022
2 parents b366471 + 0826acb commit b6c305d
Show file tree
Hide file tree
Showing 5 changed files with 197 additions and 70 deletions.
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

0 comments on commit b6c305d

Please sign in to comment.