You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.1 KiB
43 lines
1.1 KiB
import React from 'react'
|
|
import PropTypes from 'prop-types'
|
|
import FaAngleLeft from 'react-icons/lib/fa/angle-left'
|
|
import Check from 'components/Icon/Check'
|
|
|
|
import { FormattedMessage } from 'react-intl'
|
|
import messages from './messages'
|
|
|
|
import styles from './Theme.scss'
|
|
|
|
const Theme = ({ currentTheme, disableSubMenu, setTheme, themes }) => (
|
|
<div>
|
|
<header className={styles.submenuHeader} onClick={disableSubMenu}>
|
|
<FaAngleLeft />
|
|
<span>
|
|
<FormattedMessage {...messages.title} />
|
|
</span>
|
|
</header>
|
|
<ul className={styles.themes}>
|
|
{Object.keys(themes).map(theme => {
|
|
return (
|
|
<li
|
|
key={theme}
|
|
className={currentTheme === theme ? styles.active : ''}
|
|
onClick={() => setTheme(theme)}
|
|
>
|
|
<FormattedMessage {...messages[theme]} />
|
|
{currentTheme === theme && <Check />}
|
|
</li>
|
|
)
|
|
})}
|
|
</ul>
|
|
</div>
|
|
)
|
|
|
|
Theme.propTypes = {
|
|
currentTheme: PropTypes.string.isRequired,
|
|
disableSubMenu: PropTypes.func.isRequired,
|
|
setTheme: PropTypes.func,
|
|
themes: PropTypes.object.isRequired
|
|
}
|
|
|
|
export default Theme
|
|
|