-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(balance): refactoring wallet balance dropdown for correct wording…
… and designs
- Loading branch information
1 parent
2e9d293
commit f1d8d60
Showing
4 changed files
with
86 additions
and
82 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
78 changes: 0 additions & 78 deletions
78
...lockchain-wallet-v4-frontend/src/layouts/Wallet/MenuLeft/Balances/CurrencySwitch/index.js
This file was deleted.
Oops, something went wrong.
82 changes: 82 additions & 0 deletions
82
...ockchain-wallet-v4-frontend/src/layouts/Wallet/MenuLeft/Balances/CurrencySwitch/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,82 @@ | ||
import React from 'react' | ||
import { FormattedMessage } from 'react-intl' | ||
import { connect, ConnectedProps } from 'react-redux' | ||
import { bindActionCreators } from 'redux' | ||
import styled from 'styled-components' | ||
|
||
import { Button, Text } from 'blockchain-info-components' | ||
import { actions, selectors } from 'data' | ||
|
||
const Wrapper = styled.div` | ||
display: flex; | ||
flex-direction: row; | ||
width: 100%; | ||
justify-content: center; | ||
margin: 12px 0 20px; | ||
` | ||
|
||
const SwitchButton = styled(Button)` | ||
width: 200px; | ||
height: 30px; | ||
padding: 0; | ||
&:hover { | ||
border: 1px solid ${props => props.theme.blue600}; | ||
background-color: transparent; | ||
} | ||
` | ||
const ButtonText = styled(Text)` | ||
color: ${props => props.theme.blue600}; | ||
font-weight: 600; | ||
font-size: 14px; | ||
line-height: 150%; | ||
` | ||
|
||
const CurrencySwitchContainer = ({ | ||
coinDisplayed, | ||
preferencesActions, | ||
settings | ||
}: Props) => { | ||
const { currency } = settings.getOrElse({}) | ||
|
||
return ( | ||
<Wrapper> | ||
<SwitchButton | ||
onClick={preferencesActions.toggleCoinDisplayed} | ||
data-e2e='balanceDropdown-currency-switch' | ||
> | ||
<ButtonText> | ||
{coinDisplayed ? ( | ||
<FormattedMessage | ||
id='layouts.wallet.menutop.balance.walletbalance.show.in.fiat' | ||
defaultMessage='Show in {currency}' | ||
values={{ currency: currency }} | ||
/> | ||
) : ( | ||
<FormattedMessage | ||
id='layouts.wallet.menutop.balance.walletbalance.show.in.crypto' | ||
defaultMessage='Show in Crypto' | ||
/> | ||
)} | ||
</ButtonText> | ||
</SwitchButton> | ||
</Wrapper> | ||
) | ||
} | ||
|
||
const mapStateToProps = state => ({ | ||
settings: selectors.core.settings.getSettings(state), | ||
coinDisplayed: selectors.preferences.getCoinDisplayed(state) | ||
}) | ||
|
||
const mapDispatchToProps = dispatch => ({ | ||
preferencesActions: bindActionCreators(actions.preferences, dispatch) | ||
}) | ||
|
||
const connector = connect(mapStateToProps, mapDispatchToProps) | ||
|
||
type OwnProps = {} | ||
|
||
type Props = OwnProps & ConnectedProps<typeof connector> | ||
|
||
export default connector(CurrencySwitchContainer) |