Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feat/move-crypto-payment-to-separate-step' of github.co…
…m:blockchain/blockchain-wallet-v4-frontend into feat/move-crypto-payment-to-separate-step
- Loading branch information
Showing
11 changed files
with
262 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
93 changes: 93 additions & 0 deletions
93
...ockchain-wallet-v4-frontend/src/modals/SimpleBuy/CryptoSelection/CryptoSelector/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import { FlyoutWrapper } from 'components/Flyout' | ||
import { Form, InjectedFormProps, reduxForm } from 'redux-form' | ||
import { FormattedMessage } from 'react-intl' | ||
import { Icon, Text } from 'blockchain-info-components' | ||
import { Props as OwnProps, SuccessStateType } from '../index' | ||
import { SBPairType } from 'core/types' | ||
import CryptoItem from './CryptoItem' | ||
import React from 'react' | ||
import styled from 'styled-components' | ||
|
||
const Wrapper = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
flex-direction: column; | ||
height: 100%; | ||
` | ||
const Currencies = styled.div` | ||
border-top: 1px solid ${props => props.theme.grey000}; | ||
` | ||
const TopText = styled(Text)` | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
margin-bottom: 7px; | ||
` | ||
|
||
const SubTitleText = styled(Text)` | ||
margin-top: 0; | ||
` | ||
const CloseIcon = styled(Icon)` | ||
position: absolute; | ||
top: 28px; | ||
right: 28px; | ||
` | ||
export type Props = OwnProps & SuccessStateType | ||
|
||
const CryptoSelector: React.FC<InjectedFormProps<{}, Props> & | ||
Props> = props => { | ||
const handleSubmit = (pair: SBPairType) => { | ||
props.simpleBuyActions.destroyCheckout() | ||
props.simpleBuyActions.setStep({ | ||
step: 'ENTER_AMOUNT', | ||
fiatCurrency: props.fiatCurrency, | ||
pair | ||
}) | ||
} | ||
|
||
return ( | ||
<Wrapper> | ||
<Form> | ||
<FlyoutWrapper> | ||
<CloseIcon | ||
cursor | ||
data-e2e='sbCloseModalIcon' | ||
name='close' | ||
size='16px' | ||
color='grey600' | ||
role='button' | ||
onClick={props.handleClose} | ||
/> | ||
<TopText color='grey800' size='20px' weight={600}> | ||
<FormattedMessage | ||
id='modals.simplebuy.cryptoselect' | ||
defaultMessage='Buy with Cash or Card' | ||
/> | ||
</TopText> | ||
<SubTitleText color='grey600' weight={500}> | ||
<FormattedMessage | ||
id='modals.simplebuy.selectcrypto' | ||
defaultMessage='Select the crypto you want to buy.' | ||
/> | ||
</SubTitleText> | ||
</FlyoutWrapper> | ||
<Currencies> | ||
{props.pairs.map((value, index) => ( | ||
<CryptoItem | ||
key={index} | ||
rates={props.rates} | ||
supportedCoins={props.supportedCoins} | ||
value={value} | ||
onClick={() => handleSubmit(value as SBPairType)} | ||
/> | ||
))} | ||
</Currencies> | ||
</Form> | ||
</Wrapper> | ||
) | ||
} | ||
|
||
export default reduxForm<{}, Props>({ | ||
form: 'sbCryptoSelection', | ||
destroyOnUnmount: false | ||
})(CryptoSelector) |
100 changes: 13 additions & 87 deletions
100
...s/blockchain-wallet-v4-frontend/src/modals/SimpleBuy/CryptoSelection/template.success.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,92 +1,18 @@ | ||
import { FlyoutWrapper } from 'components/Flyout' | ||
import { Form, InjectedFormProps, reduxForm } from 'redux-form' | ||
import { FormattedMessage } from 'react-intl' | ||
import { Icon, Text } from 'blockchain-info-components' | ||
import { Props as OwnProps, SuccessStateType } from '.' | ||
import { SBPairType } from 'core/types' | ||
import CryptoItem from './CryptoItem' | ||
import { LinkStatePropsType, Props as OwnProps, SuccessStateType } from '.' | ||
import CryptoSelector from './CryptoSelector' | ||
import React from 'react' | ||
import styled from 'styled-components' | ||
import Unsupported from './template.unsupported' | ||
|
||
const Wrapper = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
flex-direction: column; | ||
height: 100%; | ||
` | ||
const Currencies = styled.div` | ||
border-top: 1px solid ${props => props.theme.grey000}; | ||
` | ||
const TopText = styled(Text)` | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
margin-bottom: 7px; | ||
` | ||
|
||
const SubTitleText = styled(Text)` | ||
margin-top: 0; | ||
` | ||
const CloseIcon = styled(Icon)` | ||
position: absolute; | ||
top: 28px; | ||
right: 28px; | ||
` | ||
export type Props = OwnProps & SuccessStateType | ||
|
||
const Success: React.FC<InjectedFormProps<{}, Props> & Props> = props => { | ||
const handleSubmit = (pair: SBPairType) => { | ||
props.simpleBuyActions.destroyCheckout() | ||
props.simpleBuyActions.setStep({ | ||
step: 'ENTER_AMOUNT', | ||
fiatCurrency: props.fiatCurrency, | ||
pair | ||
}) | ||
} | ||
|
||
return ( | ||
<Wrapper> | ||
<Form> | ||
<FlyoutWrapper> | ||
<CloseIcon | ||
cursor | ||
data-e2e='sbCloseModalIcon' | ||
name='close' | ||
size='16px' | ||
color='grey600' | ||
role='button' | ||
onClick={props.handleClose} | ||
/> | ||
<TopText color='grey800' size='20px' weight={600}> | ||
<FormattedMessage | ||
id='modals.simplebuy.cryptoselect' | ||
defaultMessage='Buy with Cash or Card' | ||
/> | ||
</TopText> | ||
<SubTitleText color='grey600' weight={500}> | ||
<FormattedMessage | ||
id='modals.simplebuy.selectcrypto' | ||
defaultMessage='Select the crypto you want to buy.' | ||
/> | ||
</SubTitleText> | ||
</FlyoutWrapper> | ||
<Currencies> | ||
{props.pairs.map((value, index) => ( | ||
<CryptoItem | ||
key={index} | ||
rates={props.rates} | ||
supportedCoins={props.supportedCoins} | ||
value={value} | ||
onClick={() => handleSubmit(value as SBPairType)} | ||
/> | ||
))} | ||
</Currencies> | ||
</Form> | ||
</Wrapper> | ||
const Success: React.FC<Props> = props => { | ||
return props.pairs.length && | ||
props.eligibility.eligible && | ||
props.fiatCurrency ? ( | ||
<CryptoSelector {...props} /> | ||
) : ( | ||
<Unsupported {...props} /> | ||
) | ||
} | ||
|
||
export default reduxForm<{}, Props>({ | ||
form: 'sbCryptoSelection', | ||
destroyOnUnmount: false | ||
})(Success) | ||
export type Props = OwnProps & SuccessStateType & LinkStatePropsType | ||
|
||
export default Success |
Oops, something went wrong.