mirror of
https://github.com/status-im/safe-react.git
synced 2025-01-27 18:04:52 +00:00
create sendModal component
This commit is contained in:
parent
479915d394
commit
e0c70551ee
@ -14,13 +14,13 @@ type Props = {
|
|||||||
minHeight?: number,
|
minHeight?: number,
|
||||||
}
|
}
|
||||||
|
|
||||||
const calculateStyleBased = ({ minWidth, minHeight }) => ({
|
const calculateStyleBased = (minWidth, minHeight) => ({
|
||||||
minWidth: minWidth && `${minWidth}px`,
|
minWidth: minWidth && `${minWidth}px`,
|
||||||
minHeight: minHeight && `${minHeight}px`,
|
minHeight: minHeight && `${minHeight}px`,
|
||||||
})
|
})
|
||||||
|
|
||||||
const GnoButton = (props: Props) => {
|
const GnoButton = ({ minWidth, minHeight, ...props }: Props) => {
|
||||||
const style = calculateStyleBased(props)
|
const style = calculateStyleBased(minWidth, minHeight)
|
||||||
|
|
||||||
return <Button style={style} {...props} />
|
return <Button style={style} {...props} />
|
||||||
}
|
}
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
// @flow
|
|
||||||
import React, { useState } from 'react'
|
|
||||||
import ChooseTxType from './screens/ChooseTxType'
|
|
||||||
|
|
||||||
type Props = {
|
|
||||||
onClose: () => void,
|
|
||||||
}
|
|
||||||
|
|
||||||
const Send = ({ onClose }: Props) => {
|
|
||||||
const [activeScreen, setActiveScreen] = useState('chooseTxType')
|
|
||||||
|
|
||||||
return (
|
|
||||||
<React.Fragment>
|
|
||||||
{activeScreen === 'chooseTxType' && <ChooseTxType onClose={onClose} setActiveScreen={setActiveScreen} />}
|
|
||||||
</React.Fragment>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Send
|
|
50
src/routes/safe/components/Balances/SendModal/index.jsx
Normal file
50
src/routes/safe/components/Balances/SendModal/index.jsx
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
// @flow
|
||||||
|
import React, { useState, useEffect } from 'react'
|
||||||
|
import cn from 'classnames'
|
||||||
|
import { withStyles } from '@material-ui/core/styles'
|
||||||
|
import Modal from '~/components/Modal'
|
||||||
|
import ChooseTxType from './screens/ChooseTxType'
|
||||||
|
import SendFunds from './screens/SendFunds'
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
onClose: () => void,
|
||||||
|
classes: Object,
|
||||||
|
isOpen: boolean,
|
||||||
|
}
|
||||||
|
type ActiveScreen = 'chooseTxType' | 'sendFunds'
|
||||||
|
|
||||||
|
const styles = () => ({
|
||||||
|
smallerModalWindow: {
|
||||||
|
height: 'auto',
|
||||||
|
position: 'static',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const Send = ({ onClose, isOpen, classes }: Props) => {
|
||||||
|
const [activeScreen, setActiveScreen] = useState<ActiveScreen>('chooseTxType')
|
||||||
|
const smallerModalSize = activeScreen === 'chooseTxType'
|
||||||
|
|
||||||
|
useEffect(
|
||||||
|
() => () => {
|
||||||
|
setActiveScreen('chooseTxType')
|
||||||
|
},
|
||||||
|
[isOpen],
|
||||||
|
)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
title="Send Tokens"
|
||||||
|
description="Send Tokens Form"
|
||||||
|
handleClose={onClose}
|
||||||
|
open={isOpen}
|
||||||
|
paperClassName={cn(smallerModalSize && classes.smallerModalWindow)}
|
||||||
|
>
|
||||||
|
<React.Fragment>
|
||||||
|
{activeScreen === 'chooseTxType' && <ChooseTxType onClose={onClose} setActiveScreen={setActiveScreen} />}
|
||||||
|
{activeScreen === 'sendFunds' && <SendFunds onClose={onClose} setActiveScreen={setActiveScreen} />}
|
||||||
|
</React.Fragment>
|
||||||
|
</Modal>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default withStyles(styles)(Send)
|
@ -35,9 +35,10 @@ const styles = () => ({
|
|||||||
type Props = {
|
type Props = {
|
||||||
onClose: () => void,
|
onClose: () => void,
|
||||||
classes: Object,
|
classes: Object,
|
||||||
|
setActiveScreen: Function,
|
||||||
}
|
}
|
||||||
|
|
||||||
const Send = ({ classes, onClose }: Props) => (
|
const ChooseTxType = ({ classes, onClose, setActiveScreen }: Props) => (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<Row align="center" grow className={classes.heading}>
|
<Row align="center" grow className={classes.heading}>
|
||||||
<Paragraph className={classes.manage} noMargin>
|
<Paragraph className={classes.manage} noMargin>
|
||||||
@ -50,7 +51,13 @@ const Send = ({ classes, onClose }: Props) => (
|
|||||||
<Hairline />
|
<Hairline />
|
||||||
<Row align="center">
|
<Row align="center">
|
||||||
<Col layout="column" middle="xs" className={classes.buttonColumn}>
|
<Col layout="column" middle="xs" className={classes.buttonColumn}>
|
||||||
<Button color="primary" minWidth={260} minHeight={52} onClick={onClose} variant="contained">
|
<Button
|
||||||
|
color="primary"
|
||||||
|
minWidth={260}
|
||||||
|
minHeight={52}
|
||||||
|
onClick={() => setActiveScreen('sendFunds')}
|
||||||
|
variant="contained"
|
||||||
|
>
|
||||||
SEND FUNDS
|
SEND FUNDS
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
@ -68,4 +75,4 @@ const Send = ({ classes, onClose }: Props) => (
|
|||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)
|
)
|
||||||
|
|
||||||
export default withStyles(styles)(Send)
|
export default withStyles(styles)(ChooseTxType)
|
@ -0,0 +1,47 @@
|
|||||||
|
// @flow
|
||||||
|
import * as React from 'react'
|
||||||
|
import { withStyles } from '@material-ui/core/styles'
|
||||||
|
import Close from '@material-ui/icons/Close'
|
||||||
|
import IconButton from '@material-ui/core/IconButton'
|
||||||
|
import Paragraph from '~/components/layout/Paragraph'
|
||||||
|
import Row from '~/components/layout/Row'
|
||||||
|
import Hairline from '~/components/layout/Hairline'
|
||||||
|
import { lg, sm } from '~/theme/variables'
|
||||||
|
|
||||||
|
const styles = () => ({
|
||||||
|
heading: {
|
||||||
|
padding: `${sm} ${lg}`,
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
maxHeight: '75px',
|
||||||
|
},
|
||||||
|
manage: {
|
||||||
|
fontSize: '24px',
|
||||||
|
},
|
||||||
|
closeIcon: {
|
||||||
|
height: '35px',
|
||||||
|
width: '35px',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
onClose: () => void,
|
||||||
|
classes: Object,
|
||||||
|
setActiveScreen: Function,
|
||||||
|
}
|
||||||
|
|
||||||
|
const Send = ({ classes, onClose, setActiveScreen }: Props) => (
|
||||||
|
<React.Fragment>
|
||||||
|
<Row align="center" grow className={classes.heading}>
|
||||||
|
<Paragraph className={classes.manage} noMargin>
|
||||||
|
Send Funds
|
||||||
|
</Paragraph>
|
||||||
|
<IconButton onClick={onClose} disableRipple>
|
||||||
|
<Close className={classes.closeIcon} />
|
||||||
|
</IconButton>
|
||||||
|
</Row>
|
||||||
|
<Hairline />
|
||||||
|
</React.Fragment>
|
||||||
|
)
|
||||||
|
|
||||||
|
export default withStyles(styles)(Send)
|
@ -21,9 +21,10 @@ type Props = Actions & {
|
|||||||
safeAddress: string,
|
safeAddress: string,
|
||||||
activeTokens: List<Token>,
|
activeTokens: List<Token>,
|
||||||
}
|
}
|
||||||
|
type ActiveScreen = 'tokenList' | 'addCustomToken'
|
||||||
|
|
||||||
const Tokens = (props: Props) => {
|
const Tokens = (props: Props) => {
|
||||||
const [activeScreen, setActiveScreen] = useState<string>('tokenList')
|
const [activeScreen, setActiveScreen] = useState<ActiveScreen>('tokenList')
|
||||||
const {
|
const {
|
||||||
onClose,
|
onClose,
|
||||||
classes,
|
classes,
|
||||||
|
@ -21,7 +21,7 @@ import {
|
|||||||
} from './dataFetcher'
|
} from './dataFetcher'
|
||||||
import AssetTableCell from './AssetTableCell'
|
import AssetTableCell from './AssetTableCell'
|
||||||
import Tokens from './Tokens'
|
import Tokens from './Tokens'
|
||||||
import Send from './Send'
|
import SendModal from './SendModal'
|
||||||
import Receive from './Receive'
|
import Receive from './Receive'
|
||||||
import { styles } from './style'
|
import { styles } from './style'
|
||||||
|
|
||||||
@ -159,15 +159,7 @@ class Balances extends React.Component<Props, State> {
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
</Table>
|
</Table>
|
||||||
<Modal
|
<SendModal onClose={this.onHide('Send')} isOpen={showSend} />
|
||||||
title="Send Tokens"
|
|
||||||
description="Send Tokens Form"
|
|
||||||
handleClose={this.onHide('Send')}
|
|
||||||
open={showSend}
|
|
||||||
paperClassName={classes.sendModal}
|
|
||||||
>
|
|
||||||
<Send onClose={this.onHide('Send')} />
|
|
||||||
</Modal>
|
|
||||||
<Modal
|
<Modal
|
||||||
title="Receive Tokens"
|
title="Receive Tokens"
|
||||||
description="Receive Tokens Form"
|
description="Receive Tokens Form"
|
||||||
|
@ -48,8 +48,4 @@ export const styles = (theme: Object) => ({
|
|||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
sendModal: {
|
|
||||||
height: 'auto',
|
|
||||||
position: 'static',
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user