mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 15:37:45 +00:00
[web] Add Modal Component and OptionModal
This commit is contained in:
parent
23a2409a87
commit
c0ad25715b
33
web/src/js/components/Modal/Modal.jsx
Normal file
33
web/src/js/components/Modal/Modal.jsx
Normal file
@ -0,0 +1,33 @@
|
||||
import React, { Component } from 'react'
|
||||
import { connect } from 'react-redux'
|
||||
import * as modalAction from '../../ducks/ui/modal'
|
||||
import ModalList from './ModalList'
|
||||
|
||||
class PureModal extends Component {
|
||||
|
||||
constructor(props, context) {
|
||||
super(props, context)
|
||||
}
|
||||
|
||||
render() {
|
||||
const { activeModal, hideModal } = this.props
|
||||
const ActiveModal = _.find(ModalList, m => m.name === activeModal )
|
||||
return(
|
||||
activeModal ?
|
||||
<div>
|
||||
<div className="modal-backdrop fade in"></div>
|
||||
<ActiveModal hideModal={ hideModal }/>
|
||||
</div>
|
||||
: <div/>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default connect(
|
||||
state => ({
|
||||
activeModal: state.ui.modal.activeModal
|
||||
}),
|
||||
{
|
||||
hideModal: modalAction.hideModal
|
||||
}
|
||||
)(PureModal)
|
3
web/src/js/components/Modal/ModalList.jsx
Normal file
3
web/src/js/components/Modal/ModalList.jsx
Normal file
@ -0,0 +1,3 @@
|
||||
import OptionModal from './OptionModal'
|
||||
|
||||
export default [ OptionModal, EmptyModal ]
|
33
web/src/js/components/Modal/OptionModal.jsx
Normal file
33
web/src/js/components/Modal/OptionModal.jsx
Normal file
@ -0,0 +1,33 @@
|
||||
import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
|
||||
OptionModal.prototype = {
|
||||
hideModal: PropTypes.function,
|
||||
}
|
||||
|
||||
export default function OptionModal( { hideModal }) {
|
||||
const title = 'Options'
|
||||
return (
|
||||
<div className="modal modal-visible" id="optionsModal" tabIndex="-1" role="dialog" aria-labelledby="options">
|
||||
<div className="modal-dialog modal-lg" role="document">
|
||||
<div className="modal-content">
|
||||
<div className="modal-header">
|
||||
<button type="button" className="close" data-dismiss="modal" onClick={() => { hideModal() }}>
|
||||
<i className="fa fa-fw fa-times"></i>
|
||||
</button>
|
||||
<div className="modal-title">
|
||||
<h4>{ title }</h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="modal-body">
|
||||
</div>
|
||||
|
||||
<div className="modal-footer">
|
||||
<button type="button" className="btn btn-primary">Save Changes</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
Loading…
Reference in New Issue
Block a user