Add new theme to utils

This commit is contained in:
Anthony Laibe 2018-10-10 14:40:05 +01:00 committed by Pascal Precht
parent 5967aa3dc5
commit f5ac131d93
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
4 changed files with 48 additions and 57 deletions

View File

@ -55,6 +55,7 @@
"react-router-dom": "^4.3.1",
"react-scroll-to-component": "^1.0.2",
"react-treebeard": "^2.1.0",
"reactstrap": "^6.5.0",
"redux": "^4.0.0",
"redux-saga": "^0.16.0",
"resolve": "1.6.0",

View File

@ -1,9 +1,22 @@
import PropTypes from "prop-types";
import React from 'react';
import {Page, Form, Button, Icon} from "tabler-react";
import {
Button,
InputGroup,
Card,
CardBody,
CardHeader,
Col,
FormGroup,
Input,
Row,
InputGroupAddon,
Label
} from 'reactstrap';
import {CopyToClipboard} from 'react-copy-to-clipboard';
import { calculateUnits } from '../services/unitConverter';
class Converter extends React.Component {
constructor(props) {
super(props);
@ -23,22 +36,32 @@ class Converter extends React.Component {
render() {
return(
<Page.Content title="Ether Converter">
<Form.FieldSet>
{
this.state.etherConversions.map(unit => {
return (
<Form.Group label={unit.name} key={unit.key}>
<Form.Input placeholder={unit.name} value={unit.value} onChange={e => this.handleOnChange(e, unit.key)} />
<CopyToClipboard text={unit.value} title="Copy value to clipboard">
<Button color="primary"><Icon name="copy"/></Button>
</CopyToClipboard>
</Form.Group>
)
})
}
</Form.FieldSet>
</Page.Content>
<Row className="mt-3 justify-content-md-center">
<Col xs="12" sm="9" lg="6">
<Card>
<CardHeader>
<strong>Ether Converter</strong>
</CardHeader>
<CardBody>
{
this.state.etherConversions.map(unit => (
<FormGroup key={unit.key}>
<Label htmlFor={unit.name}>{unit.name}</Label>
<InputGroup>
<Input id={unit.name} placeholder={unit.name} value={unit.value} onChange={e => this.handleOnChange(e, unit.key)} />
<InputGroupAddon addonType="append">
<CopyToClipboard text={unit.value} title="Copy value to clipboard">
<Button color="primary"><i className="fa fa-copy"></i></Button>
</CopyToClipboard>
</InputGroupAddon>
</InputGroup>
</FormGroup>
))
}
</CardBody>
</Card>
</Col>
</Row>
);
}
}

View File

@ -1,45 +1,12 @@
import React from 'react';
import {Page, Grid, List} from 'tabler-react'
import {NavLink, Route, Switch} from 'react-router-dom';
import {Route, Switch} from 'react-router-dom';
import ConverterContainer from '../containers/ConverterContainer';
const groupItems = [
{to: "/embark/utilities/converter", icon: "dollar-sign", value: "Ether Converter"}
];
const className = "d-flex align-items-center";
class UtilsLayout extends React.Component {
render() {
return (
<Grid.Row>
<Grid.Col md={3}>
<Page.Title className="my-5">Utilities</Page.Title>
<div>
<List.Group transparent={true}>
{groupItems.map((groupItem) => (
<List.GroupItem
key={groupItem.value}
className={className}
to={groupItem.to}
icon={groupItem.icon}
RootComponent={NavLink}
>
{groupItem.value}
</List.GroupItem>
))}
</List.Group>
</div>
</Grid.Col>
<Grid.Col md={9}>
<Switch>
<Route exact path="/embark/utilities/converter" component={ConverterContainer} />
</Switch>
</Grid.Col>
</Grid.Row>
);
}
}
const UtilsLayout = () => (
<Switch>
<Route exact path="/embark/utilities/converter" component={ConverterContainer} />
</Switch>
);
export default UtilsLayout;

View File

@ -9,7 +9,7 @@ import Converter from '../components/Converter';
class ConverterContainer extends React.Component {
render() {
return <Converter baseEther={this.props.baseEther}
updateBaseEther={this.props.updateBaseEther} />;
updateBaseEther={this.props.updateBaseEther} />;
}
}