mirror of https://github.com/embarklabs/embark.git
feat(utils/converter): introduce copy-to-clipboard buttons
This commit enables users to easily copy values from the converter's inputs to the clipboard.
This commit is contained in:
parent
13160e622f
commit
479aafd076
|
@ -1,6 +1,7 @@
|
||||||
import React, {Component} from 'react';
|
import React, {Component} from 'react';
|
||||||
import {Page, Form} from "tabler-react";
|
import {Page, Form, Icon, Button} from "tabler-react";
|
||||||
import Units from 'ethereumjs-units';
|
import Units from 'ethereumjs-units';
|
||||||
|
import {CopyToClipboard} from 'react-copy-to-clipboard';
|
||||||
|
|
||||||
const UNITS = [
|
const UNITS = [
|
||||||
{ key: 'wei', name: 'Wei' },
|
{ key: 'wei', name: 'Wei' },
|
||||||
|
@ -55,7 +56,13 @@ class Converter extends Component {
|
||||||
UNITS.map(unit => {
|
UNITS.map(unit => {
|
||||||
return (
|
return (
|
||||||
<Form.Group label={unit.name} key={unit.key}>
|
<Form.Group label={unit.name} key={unit.key}>
|
||||||
|
<Form.InputGroup>
|
||||||
<Form.Input placeholder={unit.name} value={this.state.units[unit.key]} onChange={e => this.calculate(e.target.value, unit.key)} />
|
<Form.Input placeholder={unit.name} value={this.state.units[unit.key]} onChange={e => this.calculate(e.target.value, unit.key)} />
|
||||||
|
|
||||||
|
<CopyToClipboard text={this.state.units[unit.key]} title="Copy value to clipboard">
|
||||||
|
<Button color="primary"><Icon name="copy"/></Button>
|
||||||
|
</CopyToClipboard>
|
||||||
|
</Form.InputGroup>
|
||||||
</Form.Group>
|
</Form.Group>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue