This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #639 from LN-Zap/feature/multiple-fiat-currency-su…
…pport Feature/multiple fiat currency support
- Loading branch information
Showing
43 changed files
with
678 additions
and
88 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,7 +112,7 @@ | |
} | ||
} | ||
|
||
.usdAmount { | ||
.fiatAmount { | ||
margin-top: 20px; | ||
opacity: 0.5; | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,7 +143,7 @@ | |
} | ||
} | ||
|
||
.usdAmount { | ||
.fiatAmount { | ||
margin-top: 10px; | ||
opacity: 0.5; | ||
font-size: 14px; | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,7 +122,7 @@ | |
} | ||
} | ||
|
||
.usdAmount { | ||
.fiatAmount { | ||
margin-top: 10px; | ||
opacity: 0.5; | ||
font-size: 14px; | ||
|
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,36 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import FaAngleLeft from 'react-icons/lib/fa/angle-left' | ||
import Isvg from 'react-inlinesvg' | ||
import checkIcon from 'icons/check.svg' | ||
import styles from './Fiat.scss' | ||
|
||
const Fiat = ({ fiatTicker, fiatTickers, disableSubMenu, setFiatTicker }) => ( | ||
<div> | ||
<header className={styles.submenuHeader} onClick={disableSubMenu}> | ||
<FaAngleLeft /> | ||
<span>Fiat currency</span> | ||
</header> | ||
<ul className={styles.fiatTickers}> | ||
{fiatTickers.map(ft => ( | ||
<li | ||
key={ft} | ||
className={fiatTicker === ft ? styles.active : ''} | ||
onClick={() => setFiatTicker(ft)} | ||
> | ||
<span>{ft}</span> | ||
{fiatTicker === ft && <Isvg src={checkIcon} />} | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
) | ||
|
||
Fiat.propTypes = { | ||
fiatTicker: PropTypes.string.isRequired, | ||
fiatTickers: PropTypes.array.isRequired, | ||
disableSubMenu: PropTypes.func.isRequired, | ||
setFiatTicker: PropTypes.func.isRequired | ||
} | ||
|
||
export default Fiat |
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,42 @@ | ||
@import '../../styles/variables.scss'; | ||
|
||
.submenuHeader { | ||
padding: 20px; | ||
background: lighten(#1d1f27, 20%); | ||
font-size: 10px; | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: end; | ||
align-items: center; | ||
transition: all 0.25s; | ||
|
||
&:hover { | ||
background: lighten(#1d1f27, 10%); | ||
} | ||
} | ||
|
||
.fiatTickers { | ||
height: 300px; | ||
overflow-y: scroll; | ||
|
||
li { | ||
background: #191919; | ||
cursor: pointer; | ||
border-bottom: 1px solid #0f0f0f; | ||
transition: 0.25s hover; | ||
|
||
&.active { | ||
background: #0f0f0f; | ||
|
||
svg { | ||
height: 10px; | ||
width: 10px; | ||
color: $green; | ||
} | ||
} | ||
|
||
span:nth-child(1) { | ||
line-height: 12px; | ||
} | ||
} | ||
} |
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,19 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import FaAngleRight from 'react-icons/lib/fa/angle-right' | ||
import styles from './Menu.scss' | ||
|
||
const Menu = ({ setActiveSubMenu }) => ( | ||
<ul> | ||
<li className={styles.fiat} onClick={() => setActiveSubMenu('fiat')}> | ||
<span>Fiat Currency</span> | ||
<FaAngleRight /> | ||
</li> | ||
</ul> | ||
) | ||
|
||
Menu.propTypes = { | ||
setActiveSubMenu: PropTypes.func.isRequired | ||
} | ||
|
||
export default Menu |
Empty file.
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,76 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import Menu from './Menu' | ||
import Fiat from './Fiat' | ||
import styles from './Settings.scss' | ||
|
||
class Settings extends React.Component { | ||
constructor(props) { | ||
super(props) | ||
|
||
this.setWrapperRef = this.setWrapperRef.bind(this) | ||
this.handleClickOutside = this.handleClickOutside.bind(this) | ||
this.renderSettings = this.renderSettings.bind(this) | ||
} | ||
|
||
componentDidMount() { | ||
document.addEventListener('mousedown', this.handleClickOutside) | ||
} | ||
|
||
componentWillUnmount() { | ||
document.removeEventListener('mousedown', this.handleClickOutside) | ||
} | ||
|
||
// Set the wrapper ref | ||
setWrapperRef(node) { | ||
this.wrapperRef = node | ||
} | ||
|
||
// Alert if clicked on outside of element | ||
handleClickOutside(event) { | ||
const { toggleSettings, settings } = this.props | ||
|
||
if (this.wrapperRef && !this.wrapperRef.contains(event.target) && settings.settingsOpen) { | ||
// Do not toggle the settings if they user clicked on their alias | ||
// as that will cause us to double toggle and re-open it | ||
if ( | ||
typeof event.target.className === 'string' && | ||
event.target.className.includes('aliasText') | ||
) { | ||
return | ||
} | ||
|
||
// The user clicked outside of the settings box and not on the | ||
// alias so we should toggle the settings | ||
toggleSettings() | ||
} | ||
} | ||
|
||
renderSettings() { | ||
const { settings, fiatProps, setActiveSubMenu } = this.props | ||
|
||
switch (settings.activeSubMenu) { | ||
case 'fiat': | ||
return <Fiat {...fiatProps} /> | ||
default: | ||
return <Menu setActiveSubMenu={setActiveSubMenu} /> | ||
} | ||
} | ||
|
||
render() { | ||
return ( | ||
<div className={styles.container} ref={this.setWrapperRef}> | ||
{this.renderSettings()} | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
Settings.propTypes = { | ||
settings: PropTypes.object.isRequired, | ||
setActiveSubMenu: PropTypes.func.isRequired, | ||
toggleSettings: PropTypes.func.isRequired, | ||
fiatProps: PropTypes.object.isRequired | ||
} | ||
|
||
export default Settings |
Oops, something went wrong.