cosmos-multisig-ui/components/forms/FindMultisigForm.js
2021-04-27 08:18:29 -04:00

85 lines
2.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import axios from "axios";
import React from "react";
import { withRouter } from "next/router";
import Button from "../inputs/Button";
import StackableContainer from "../layout/StackableContainer";
import Input from "../inputs/Input";
class FindMultisigForm extends React.Component {
constructor(props) {
super(props);
this.state = {
address: "",
keyError: "",
processing: false,
};
}
handleChange = (e) => {
this.setState({
[e.target.name]: e.target.value,
});
};
handleSearch = async () => {
this.setState({ processing: true });
this.props.router.push(`/multi/${this.state.address}`);
};
render() {
return (
<StackableContainer>
<StackableContainer lessPadding>
<p>
Already have a multisig address? Enter it below. If its a valid
address, you will be able to view its transactions and create new
ones.
</p>
</StackableContainer>
<StackableContainer lessPadding lessMargin>
<Input
onChange={this.handleChange}
value={this.state.address}
label="Multisig Address"
name="address"
placeholder="cosmos1vqpjljwsynsn58dugz0w8ut7kun7t8ls2qkmsq"
/>
<Button
label="Use this Multisig"
onClick={this.handleSearch}
primary
/>
</StackableContainer>
<StackableContainer lessPadding>
<p className="create-help">Don't have a multisig?</p>
<Button
label="Create New Multisig"
onClick={() => this.props.router.push("create")}
/>
</StackableContainer>
<style jsx>{`
.multisig-form {
display: flex;
flex-direction: column;
align-items: center;
}
.error {
color: coral;
font-size: 0.8em;
text-align: left;
margin: 0.5em 0;
}
.create-help {
text-align: center;
}
`}</style>
</StackableContainer>
);
}
}
export default withRouter(FindMultisigForm);