Refactor OpenPaper component. Now it accepts width for container component
This commit is contained in:
parent
0ba812f7f5
commit
4cc92e5361
|
@ -22,18 +22,27 @@ type Props = {
|
||||||
classes: Object,
|
classes: Object,
|
||||||
children: React$Node,
|
children: React$Node,
|
||||||
controls: React$Node,
|
controls: React$Node,
|
||||||
|
container?: number,
|
||||||
padding?: boolean,
|
padding?: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const generateContainerStyleFrom = (container?: number) => ({
|
||||||
|
maxWidth: container ? `${container}px` : undefined,
|
||||||
|
})
|
||||||
|
|
||||||
const OpenPaper = ({
|
const OpenPaper = ({
|
||||||
classes, children, controls, padding = true,
|
classes, children, controls, container, padding = true,
|
||||||
}: Props) => (
|
}: Props) => {
|
||||||
|
const containerStyle = generateContainerStyleFrom(container)
|
||||||
|
|
||||||
|
return (
|
||||||
<Paper className={classes.root} elevation={1}>
|
<Paper className={classes.root} elevation={1}>
|
||||||
<Block className={`${classes.container} ${padding ? classes.padding : ''}`}>
|
<Block style={containerStyle} className={`${classes.container} ${padding ? classes.padding : ''}`}>
|
||||||
{children}
|
{children}
|
||||||
</Block>
|
</Block>
|
||||||
{ controls }
|
{ controls }
|
||||||
</Paper>
|
</Paper>
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
export default withStyles(styles)(OpenPaper)
|
export default withStyles(styles)(OpenPaper)
|
||||||
|
|
|
@ -5,9 +5,11 @@ import Field from '~/components/forms/Field'
|
||||||
import TextField from '~/components/forms/TextField'
|
import TextField from '~/components/forms/TextField'
|
||||||
import { required } from '~/components/forms/validator'
|
import { required } from '~/components/forms/validator'
|
||||||
import Block from '~/components/layout/Block'
|
import Block from '~/components/layout/Block'
|
||||||
|
import Row from '~/components/layout/Row'
|
||||||
import { FIELD_NAME } from '~/routes/open/components/fields'
|
import { FIELD_NAME } from '~/routes/open/components/fields'
|
||||||
import Paragraph from '~/components/layout/Paragraph'
|
import Paragraph from '~/components/layout/Paragraph'
|
||||||
import OpenPaper from '~/components/Stepper/OpenPaper'
|
import OpenPaper from '~/components/Stepper/OpenPaper'
|
||||||
|
import { sm } from '~/theme/variables'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
classes: Object,
|
classes: Object,
|
||||||
|
@ -16,6 +18,13 @@ type Props = {
|
||||||
const styles = () => ({
|
const styles = () => ({
|
||||||
root: {
|
root: {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
|
maxWidth: '440px',
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
flexWrap: 'nowrap',
|
||||||
|
},
|
||||||
|
dot: {
|
||||||
|
marginRight: sm,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -27,16 +36,22 @@ const SafeName = ({ classes }: Props) => (
|
||||||
By continuing you consent with the terms of use and privacy policy.
|
By continuing you consent with the terms of use and privacy policy.
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
</Block>
|
</Block>
|
||||||
<Block margin="md">
|
<Row margin="md" className={classes.text}>
|
||||||
|
<Paragraph noMargin className={classes.dot} color="secondary">
|
||||||
|
●
|
||||||
|
</Paragraph>
|
||||||
<Paragraph noMargin size="md" color="primary" weight="bolder">
|
<Paragraph noMargin size="md" color="primary" weight="bolder">
|
||||||
● I understand that my funds are held securely in my Safe. They cannot be accessed by Gnosis.
|
I understand that my funds are held securely in my Safe. They cannot be accessed by Gnosis.
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
</Block>
|
</Row>
|
||||||
<Block margin="md">
|
<Row margin="md">
|
||||||
<Paragraph size="md" color="primary" weight="bolder">
|
<Paragraph noMargin className={classes.dot} color="secondary">
|
||||||
● My Safe is a smart contract on the Ethereum blockchain.
|
●
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
</Block>
|
<Paragraph noMargin size="md" color="primary" weight="bolder">
|
||||||
|
My Safe is a smart contract on the Ethereum blockchain.
|
||||||
|
</Paragraph>
|
||||||
|
</Row>
|
||||||
<Block margin="lg" className={classes.root}>
|
<Block margin="lg" className={classes.root}>
|
||||||
<Field
|
<Field
|
||||||
name={FIELD_NAME}
|
name={FIELD_NAME}
|
||||||
|
@ -53,7 +68,7 @@ const SafeName = ({ classes }: Props) => (
|
||||||
const SafeNameForm = withStyles(styles)(SafeName)
|
const SafeNameForm = withStyles(styles)(SafeName)
|
||||||
|
|
||||||
const SafeNamePage = () => (controls: React$Node) => (
|
const SafeNamePage = () => (controls: React$Node) => (
|
||||||
<OpenPaper controls={controls}>
|
<OpenPaper controls={controls} container={600}>
|
||||||
<SafeNameForm />
|
<SafeNameForm />
|
||||||
</OpenPaper>
|
</OpenPaper>
|
||||||
)
|
)
|
||||||
|
|
|
@ -19,9 +19,6 @@ type Props = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = () => ({
|
const styles = () => ({
|
||||||
root: {
|
|
||||||
maxWidth: '450px',
|
|
||||||
},
|
|
||||||
owners: {
|
owners: {
|
||||||
paddingLeft: md,
|
paddingLeft: md,
|
||||||
},
|
},
|
||||||
|
@ -44,7 +41,7 @@ const SafeThreshold = ({ classes, values }: Props) => {
|
||||||
const numOwners = getNumOwnersFrom(values)
|
const numOwners = getNumOwnersFrom(values)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Block className={classes.root}>
|
<React.Fragment>
|
||||||
<Block className={classes.title} margin="md">
|
<Block className={classes.title} margin="md">
|
||||||
<Paragraph size="lg" color="primary" weight="bolder" noMargin>
|
<Paragraph size="lg" color="primary" weight="bolder" noMargin>
|
||||||
Set the required owner confirmations:
|
Set the required owner confirmations:
|
||||||
|
@ -85,7 +82,7 @@ const SafeThreshold = ({ classes, values }: Props) => {
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</Block>
|
</React.Fragment>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +90,7 @@ const SafeThresholdForm = withStyles(styles)(SafeThreshold)
|
||||||
|
|
||||||
const SafeOwnersPage = () => (controls: React$Node, { values }: Object) => (
|
const SafeOwnersPage = () => (controls: React$Node, { values }: Object) => (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<OpenPaper controls={controls}>
|
<OpenPaper controls={controls} container={450}>
|
||||||
<SafeThresholdForm values={values} />
|
<SafeThresholdForm values={values} />
|
||||||
</OpenPaper>
|
</OpenPaper>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
|
|
Loading…
Reference in New Issue