mirror of
https://github.com/urbit/shrub.git
synced 2025-01-03 01:54:43 +03:00
btc: feepicker dismissal
This commit is contained in:
parent
87855eadc4
commit
84f6aa33d0
@ -19,7 +19,27 @@ export default class FeePicker extends Component {
|
||||
selected: 'mid'
|
||||
}
|
||||
|
||||
this.select = this.select.bind(this);
|
||||
this.select = this.select.bind(this);
|
||||
this.clickDismiss = this.clickDismiss.bind(this);
|
||||
this.setModalRef = this.setModalRef.bind(this);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
document.addEventListener("click", this.clickDismiss);
|
||||
}
|
||||
|
||||
componentWillUnount() {
|
||||
document.removeEventListener("click", this.clickDismiss);
|
||||
}
|
||||
|
||||
setModalRef(n) {
|
||||
this.modalRef = n;
|
||||
}
|
||||
|
||||
clickDismiss(e) {
|
||||
if (this.modalRef && !(this.modalRef.contains(e.target))){
|
||||
this.props.feeDismiss();
|
||||
}
|
||||
}
|
||||
|
||||
select(which) {
|
||||
@ -30,6 +50,7 @@ export default class FeePicker extends Component {
|
||||
render() {
|
||||
return (
|
||||
<Box
|
||||
ref={this.setModalRef}
|
||||
position="absolute" p={4}
|
||||
border="1px solid green" zIndex={10}
|
||||
backgroundColor="white" borderRadius={3}
|
||||
|
@ -54,10 +54,15 @@ export default class Send extends Component {
|
||||
this.initPayment = this.initPayment.bind(this);
|
||||
this.checkPayee = this.checkPayee.bind(this);
|
||||
this.feeSelect = this.feeSelect.bind(this);
|
||||
this.feeDismiss = this.feeDismiss.bind(this);
|
||||
this.toggleSignMethod = this.toggleSignMethod.bind(this);
|
||||
this.setSignMethod = this.setSignMethod.bind(this);
|
||||
}
|
||||
|
||||
feeDismiss() {
|
||||
this.setState({showModal: false});
|
||||
}
|
||||
|
||||
feeSelect(which) {
|
||||
this.setState({feeValue: which});
|
||||
}
|
||||
@ -352,7 +357,7 @@ export default class Send extends Component {
|
||||
<Icon icon="ChevronSouth"
|
||||
fontSize="14px"
|
||||
color="lightGray"
|
||||
onClick={() => { this.setState({showModal: !this.state.showModal}); }}
|
||||
onClick={() => {if (!this.state.showModal) this.setState({showModal: true}); }}
|
||||
cursor="pointer"/>
|
||||
</Row>
|
||||
</Row>
|
||||
@ -361,6 +366,7 @@ export default class Send extends Component {
|
||||
<FeePicker
|
||||
feeChoices={this.state.feeChoices}
|
||||
feeSelect={this.feeSelect}
|
||||
feeDismiss={this.feeDismiss}
|
||||
/>
|
||||
}
|
||||
</Col>
|
||||
|
Loading…
Reference in New Issue
Block a user