Browse Source

Styling updates for settings

master
meriadec 7 years ago
parent
commit
5cfe146422
No known key found for this signature in database GPG Key ID: 1D2FC2305E2CB399
  1. 1
      .eslintrc
  2. 10
      src/components/SettingsPage/Display.js
  3. 35
      src/components/SettingsPage/Profile.js
  4. 7
      src/components/base/Label.js
  5. 5
      src/components/base/Modal/index.js
  6. 51
      src/components/modals/AddAccount.js

1
.eslintrc

@ -16,6 +16,7 @@
"import/prefer-default-export": 0, "import/prefer-default-export": 0,
"import/no-named-as-default": 0, "import/no-named-as-default": 0,
"jsx-a11y/anchor-is-valid": 0, "jsx-a11y/anchor-is-valid": 0,
"jsx-a11y/label-has-for": 0,
"new-cap": 0, "new-cap": 0,
"no-nested-ternary": 0, "no-nested-ternary": 0,
"no-param-reassign": 0, "no-param-reassign": 0,

10
src/components/SettingsPage/Display.js

@ -76,8 +76,8 @@ class TabProfile extends PureComponent<Props, State> {
return ( return (
<form onSubmit={this.handleSubmit}> <form onSubmit={this.handleSubmit}>
<Card> <Card flow={3}>
<Box> <Box flow={1}>
<Label>{t('settings.display.language')}</Label> <Label>{t('settings.display.language')}</Label>
<Select <Select
onChange={item => this.handleChangeInput('language')(item.key)} onChange={item => this.handleChangeInput('language')(item.key)}
@ -86,8 +86,10 @@ class TabProfile extends PureComponent<Props, State> {
items={languages} items={languages}
/> />
</Box> </Box>
<Box> <Box horizontal justify="flex-end">
<Button type="submit">Save</Button> <Button primary type="submit">
Save
</Button>
</Box> </Box>
</Card> </Card>
</form> </form>

35
src/components/SettingsPage/Profile.js

@ -1,7 +1,6 @@
// @flow // @flow
import React, { PureComponent } from 'react' import React, { PureComponent } from 'react'
import styled from 'styled-components'
import { connect } from 'react-redux' import { connect } from 'react-redux'
import bcrypt from 'bcryptjs' import bcrypt from 'bcryptjs'
@ -17,11 +16,7 @@ import { unlock } from 'reducers/application'
import Box, { Card } from 'components/base/Box' import Box, { Card } from 'components/base/Box'
import Input from 'components/base/Input' import Input from 'components/base/Input'
import Button from 'components/base/Button' import Button from 'components/base/Button'
import Label from 'components/base/Label'
const Label = styled.label`
display: block;
text-transform: uppercase;
`
type InputValue = SettingsProfile type InputValue = SettingsProfile
@ -87,17 +82,19 @@ class TabProfile extends PureComponent<Props, State> {
const { inputValue } = this.state const { inputValue } = this.state
return ( return (
<form onSubmit={this.handleSubmit}> <form onSubmit={this.handleSubmit}>
<Card> <Card flow={3}>
<Box horizontal> <label>
<input <Box horizontal align="center" flow={1}>
type="checkbox" <input
checked={get(inputValue, 'password.state', false)} type="checkbox"
onChange={e => this.handleChangeInput('password.state')(e.target.checked)} checked={get(inputValue, 'password.state', false)}
/>{' '} onChange={e => this.handleChangeInput('password.state')(e.target.checked)}
with password />
</Box> <div>{' with password'}</div>
</Box>
</label>
{get(inputValue, 'password.state') === true && ( {get(inputValue, 'password.state') === true && (
<Box> <Box flow={1}>
<Label>Password</Label> <Label>Password</Label>
<Input <Input
value={get(inputValue, 'password.value', '')} value={get(inputValue, 'password.value', '')}
@ -106,8 +103,10 @@ class TabProfile extends PureComponent<Props, State> {
/> />
</Box> </Box>
)} )}
<Box> <Box horizontal justify="flex-end">
<Button type="submit">Save</Button> <Button primary type="submit">
Save
</Button>
</Box> </Box>
</Card> </Card>
</form> </form>

7
src/components/base/Label.js

@ -1,6 +1,11 @@
import styled from 'styled-components' import styled from 'styled-components'
import { fontSize } from 'styled-system'
export default styled.label` export default styled.label.attrs({
fontSize: 0,
})`
${fontSize};
display: block; display: block;
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 1px;
` `

5
src/components/base/Modal/index.js

@ -27,7 +27,7 @@ type Props = {
} }
const springConfig = { const springConfig = {
stiffness: 400, stiffness: 350,
} }
const mapStateToProps = (state, { name, isOpened }) => ({ const mapStateToProps = (state, { name, isOpened }) => ({
@ -137,6 +137,7 @@ export class Modal extends PureComponent<Props> {
export const ModalBody = ({ export const ModalBody = ({
children, children,
onClose, onClose,
...props
}: { }: {
children: Element<any> | string, children: Element<any> | string,
onClose?: Function, onClose?: Function,
@ -147,7 +148,7 @@ export const ModalBody = ({
<Icon fontSize={3} name="times" /> <Icon fontSize={3} name="times" />
</CloseContainer> </CloseContainer>
)} )}
{children} <Box {...props}>{children}</Box>
</Body> </Body>
) )

51
src/components/modals/AddAccount.js

@ -14,6 +14,8 @@ import { sendEvent } from 'renderer/events'
import { addAccount } from 'actions/accounts' import { addAccount } from 'actions/accounts'
import Box from 'components/base/Box'
import Text from 'components/base/Text'
import Button from 'components/base/Button' import Button from 'components/base/Button'
import Input from 'components/base/Input' import Input from 'components/base/Input'
import Label from 'components/base/Label' import Label from 'components/base/Label'
@ -23,25 +25,31 @@ import Select from 'components/base/Select'
const Steps = { const Steps = {
createAccount: (props: Object) => ( createAccount: (props: Object) => (
<form onSubmit={props.onSubmit}> <form onSubmit={props.onSubmit}>
<div> <Box flow={3}>
<Label>Currency</Label> <Box flow={1}>
<Select <Label>Currency</Label>
placeholder="Choose a wallet..." <Select
onChange={item => props.onChangeInput('wallet')(item.key)} placeholder="Choose a wallet..."
renderSelected={item => item.name} onChange={item => props.onChangeInput('wallet')(item.key)}
items={[ renderSelected={item => item.name}
{ items={[
key: 'btc', {
name: 'Bitcoin', key: 'btc',
}, name: 'Bitcoin',
]} },
/> ]}
</div> />
<div> </Box>
<Label>Account name</Label> <Box flow={1}>
<Input onChange={props.onChangeInput('accountName')} value={props.value.accountName} /> <Label>Account name</Label>
</div> <Input onChange={props.onChangeInput('accountName')} value={props.value.accountName} />
<Button type="submit">Create account</Button> </Box>
<Box horizontal justify="flex-end">
<Button primary type="submit">
Create account
</Button>
</Box>
</Box>
</form> </form>
), ),
connectDevice: () => <div>Connect your Ledger</div>, connectDevice: () => <div>Connect your Ledger</div>,
@ -270,7 +278,10 @@ class AddAccountModal extends PureComponent<Props, State> {
preventBackdropClick preventBackdropClick
onClose={this.handleClose} onClose={this.handleClose}
render={({ onClose }) => ( render={({ onClose }) => (
<ModalBody onClose={onClose}> <ModalBody onClose={onClose} flow={3}>
<Text fontSize={4} color="steel">
{'Add account'}
</Text>
<Step {...this.getStepProps()} /> <Step {...this.getStepProps()} />
</ModalBody> </ModalBody>
)} )}

Loading…
Cancel
Save