mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 07:08:10 +00:00
[web] Update the Structure of Modal component.
This commit is contained in:
parent
7a50301af3
commit
7baf3069b1
@ -1,6 +1,5 @@
|
||||
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 {
|
||||
@ -10,15 +9,10 @@ class PureModal extends Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { activeModal, hideModal } = this.props
|
||||
const { activeModal } = this.props
|
||||
const ActiveModal = ModalList.find(m => m.name === activeModal )
|
||||
return(
|
||||
activeModal ?
|
||||
<div>
|
||||
<div className="modal-backdrop fade in"></div>
|
||||
<ActiveModal hideModal={ hideModal }/>
|
||||
</div>
|
||||
: <div/>
|
||||
activeModal ? <ActiveModal/> : <div/>
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -26,8 +20,5 @@ class PureModal extends Component {
|
||||
export default connect(
|
||||
state => ({
|
||||
activeModal: state.ui.modal.activeModal
|
||||
}),
|
||||
{
|
||||
hideModal: modalAction.hideModal
|
||||
}
|
||||
})
|
||||
)(PureModal)
|
||||
|
16
web/src/js/components/Modal/ModalLayout.jsx
Normal file
16
web/src/js/components/Modal/ModalLayout.jsx
Normal file
@ -0,0 +1,16 @@
|
||||
import React from 'react'
|
||||
|
||||
export default function ModalLayout ({ children }) {
|
||||
return (
|
||||
<div>
|
||||
<div className="modal-backdrop fade in"></div>
|
||||
<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">
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
@ -1,3 +1,13 @@
|
||||
import OptionModal from './OptionModal'
|
||||
import React from 'react'
|
||||
import ModalLayout from './ModalLayout'
|
||||
import OptionContent from './OptionModal'
|
||||
|
||||
function OptionModal() {
|
||||
return (
|
||||
<ModalLayout>
|
||||
<OptionContent/>
|
||||
</ModalLayout>
|
||||
)
|
||||
}
|
||||
|
||||
export default [ OptionModal ]
|
||||
|
@ -1,33 +0,0 @@
|
||||
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