Created
September 8, 2019 20:07
-
-
Save MonteLogic/6fd1b023bb27e5cd6e3571e695d93d93 to your computer and use it in GitHub Desktop.
Modal Issue #77da4
This file contains hidden or 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
import React, { Component } from 'react'; | |
import { connect } from 'react-redux'; | |
import listActions from '../../../redux/todo/actions'; | |
import ListModal from '../ListModal/ListModal'; | |
import modalActions from '../../../redux/modal/actions'; | |
// Duck file. | |
// import { actions } from '../../ducks/modal.js'; | |
//End duck file. | |
import '../ListItem/ListItem.css'; | |
const { completeToDoRequest, openModalRequest } = listActions; | |
const { showModalRequest } = modalActions; | |
class ListItem extends Component { | |
clickModal = () => { | |
const { showModalRequest, showModalFunction } = this.props; | |
showModalFunction(showModalRequest); | |
} | |
inspectModal = () => { | |
console.log(5); | |
} | |
completeClick = () => { | |
const { todoId, completeToDo } = this.props; | |
completeToDo(todoId); | |
}; | |
render() { | |
const { todo } = this.props; | |
return ( | |
<div key="toDoName" className="to-do-list-item" onClick={this.inspectModal}> | |
<h4> | |
{todo.title} <br /> | |
{todo.company} | |
<span | |
className="done-button complete-todo-item blue-text btn-custom" | |
role="button" | |
tabIndex="0" | |
onClick={this.completeClick} | |
onKeyPress={() => {}} | |
> | |
<i className="done-icon">Done</i> | |
</span> | |
<br /> | |
<ListModal/> | |
</h4> | |
<p>{todo.message}</p> | |
</div> | |
); | |
} | |
} | |
const mapDispatchToProps = { | |
completeToDo: completeToDoRequest, | |
showModal: showModalRequest | |
} | |
// const mapStateToProps = state => ({ | |
// modal: state.ModalReducer.modalProps | |
// }); | |
export default connect( | |
null, | |
mapDispatchToProps | |
)(ListItem); |
This file contains hidden or 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
import React, { Component } from 'react' | |
import Button from './ButtonModal/Button/Button'; | |
import modalActions from '../../../redux/modal/actions'; | |
import ModalExample from '../ListModal/ButtonModal/ModalExample'; | |
import { connect } from 'react-redux'; | |
export class ListModal extends Component { | |
render() { | |
return ( | |
<div> | |
<Button | |
onClick={() => { | |
this.props.openModal({ | |
modalType: ModalExample, | |
modalProps: { | |
exit: [ | |
{ | |
text: '08a09dsf*as0df8', | |
intent: 'success', | |
onClick: () => { | |
this.props.closeModal(); | |
} | |
} | |
], | |
title: 'Title', | |
text: 'Text', | |
subTitle: 'Subtitle', | |
hasClose: false, | |
buttons: [ | |
{ | |
text: 'Text', | |
intent: 'success', | |
onClick: () => { | |
alert('Ок =)'); | |
this.props.closeModal(); | |
} | |
}, | |
{ | |
text: 'Text', | |
onClick: () => { | |
alert('Nooo =('); | |
this.props.closeModal(); | |
} | |
} | |
] | |
} | |
}); | |
}} | |
text="Open Modal" | |
/> | |
</div> | |
) | |
} | |
} | |
const mapDispatchToProps = dispatch => { | |
return { | |
openModal: modalParams => dispatch(modalActions.openModal(modalParams)), | |
closeModal: () => dispatch(modalActions.closeModal()) | |
}; | |
}; | |
export default connect(null, mapDispatchToProps)(ListModal); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment