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-router-dom": "^4.3.1",
"react-scroll-to-component": "^1.0.2", "react-scroll-to-component": "^1.0.2",
"react-treebeard": "^2.1.0", "react-treebeard": "^2.1.0",
"reactstrap": "^6.5.0",
"redux": "^4.0.0", "redux": "^4.0.0",
"redux-saga": "^0.16.0", "redux-saga": "^0.16.0",
"resolve": "1.6.0", "resolve": "1.6.0",

View File

@ -1,9 +1,22 @@
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import React from 'react'; 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 {CopyToClipboard} from 'react-copy-to-clipboard';
import { calculateUnits } from '../services/unitConverter'; import { calculateUnits } from '../services/unitConverter';
class Converter extends React.Component { class Converter extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -23,22 +36,32 @@ class Converter extends React.Component {
render() { render() {
return( return(
<Page.Content title="Ether Converter"> <Row className="mt-3 justify-content-md-center">
<Form.FieldSet> <Col xs="12" sm="9" lg="6">
{ <Card>
this.state.etherConversions.map(unit => { <CardHeader>
return ( <strong>Ether Converter</strong>
<Form.Group label={unit.name} key={unit.key}> </CardHeader>
<Form.Input placeholder={unit.name} value={unit.value} onChange={e => this.handleOnChange(e, unit.key)} /> <CardBody>
<CopyToClipboard text={unit.value} title="Copy value to clipboard"> {
<Button color="primary"><Icon name="copy"/></Button> this.state.etherConversions.map(unit => (
</CopyToClipboard> <FormGroup key={unit.key}>
</Form.Group> <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">
</Form.FieldSet> <CopyToClipboard text={unit.value} title="Copy value to clipboard">
</Page.Content> <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 React from 'react';
import {Page, Grid, List} from 'tabler-react' import {Route, Switch} from 'react-router-dom';
import {NavLink, Route, Switch} from 'react-router-dom';
import ConverterContainer from '../containers/ConverterContainer'; import ConverterContainer from '../containers/ConverterContainer';
const groupItems = [ const UtilsLayout = () => (
{to: "/embark/utilities/converter", icon: "dollar-sign", value: "Ether Converter"} <Switch>
]; <Route exact path="/embark/utilities/converter" component={ConverterContainer} />
</Switch>
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>
);
}
}
export default UtilsLayout; export default UtilsLayout;

View File

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