-
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.
Merge pull request #56 from BuddiX/add_destroy_animation
Add destroy animation
- Loading branch information
Showing
9 changed files
with
109 additions
and
36 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,11 @@ | ||
import React from 'react' | ||
|
||
import '../../../stylesheets/confirm_btn.scss' | ||
|
||
const ConfirmBtn = (message) => { | ||
return( | ||
<button className="confirm-btn">{ message.message }</button> | ||
) | ||
} | ||
|
||
export default ConfirmBtn |
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 |
---|---|---|
@@ -1,46 +1,75 @@ | ||
import React, { Component } from 'react' | ||
import { connect } from 'react-redux' | ||
|
||
import Modal from 'react-modal' | ||
|
||
import ConfirmBtn from '../atoms/confirm-btn' | ||
|
||
import { nullifySelectedAssignment } from '../../actions/assignments' | ||
import { setModalStatus, resetModalStatus } from '../../actions/common' | ||
|
||
import '../../../stylesheets/modal.scss' | ||
|
||
const customStyles = { | ||
overlay : { | ||
zIndex : '1000', | ||
backgroundColor : 'rgba(13, 25, 36, 0)' | ||
}, | ||
content : { | ||
display : 'flex', | ||
justifyContent : 'center', | ||
flexWrap : 'wrap', | ||
width : '400px', | ||
height : '100px', | ||
backgroundColor : 'rgba(13, 25, 36, 0.7)', | ||
top : '50%', | ||
left : '50%', | ||
right : 'auto', | ||
bottom : 'auto', | ||
padding : '10px', | ||
marginRight : '-50%', | ||
color : '#fff', | ||
transform : 'translate(-50%, -50%)' | ||
} | ||
} | ||
|
||
Modal.setAppElement('#app') | ||
|
||
class ConfirmModal extends Component { | ||
constructor(props) { | ||
super(props) | ||
} | ||
|
||
openModal() { | ||
this.props.setModalStatus(true) | ||
} | ||
|
||
afterOpenModal() { | ||
//this.subtitle.style.color = '#f00'; | ||
this.state ={ | ||
destroy: "本当に選択タスクを破壊しますか?", | ||
restore: "本当に選択したタスクを元の場所に戻しますか?" | ||
} | ||
} | ||
|
||
closeModal() { | ||
closeModal(isDestroy) { | ||
this.props.resetModalStatus(false) | ||
if(isDestroy) { | ||
this.props.parentMethod(this.props.selectedAssignments) | ||
this.props.nullifySelectedAssignment() | ||
} | ||
} | ||
|
||
render(){ | ||
return( | ||
<div>TEST</div> | ||
<Modal | ||
isOpen={this.props.modalIsOpen} | ||
style={customStyles} | ||
contentLabel="Example Modal" | ||
> | ||
<div className="modal-warning">{this.state.destroy}</div> | ||
<div className="modal-confirm-buttons"> | ||
<div onClick={this.closeModal.bind(this, false)}><ConfirmBtn message="いいえ" /></div> | ||
<div onClick={this.closeModal.bind(this, true)}><ConfirmBtn message="はい" /></div> | ||
</div> | ||
</Modal> | ||
) | ||
} | ||
} | ||
|
||
export default connect( | ||
({modalIsOpen}) => ({modalIsOpen}), | ||
{ setModalStatus, resetModalStatus } | ||
({modalIsOpen, selectedAssignments}) => ({modalIsOpen, selectedAssignments}), | ||
{ nullifySelectedAssignment, setModalStatus, resetModalStatus } | ||
)(ConfirmModal) |
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,14 @@ | ||
.confirm-btn { | ||
display: block; | ||
width: 100px; | ||
height: 25px; | ||
font-size: 14px; | ||
font-family: inherit; | ||
font-weight: lighter; | ||
line-height: 25px; | ||
border: 1px solid #fff; | ||
border-radius: 10px; | ||
background-color: inherit; | ||
padding: 0 10px; | ||
margin: 0 10px; | ||
} |
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,14 @@ | ||
.modal-warning { | ||
width: 400px; | ||
margin: 10px auto; | ||
text-align: center; | ||
font-size: 14px; | ||
font-family: inherit; | ||
font-weight: lighter; | ||
letter-spacing: 2px; | ||
} | ||
.modal-confirm-buttons { | ||
width: 400px; | ||
display:flex; | ||
justify-content: center; | ||
} |
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