1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2025-02-14 21:10:41 +01:00

fix ThemeSwitch test

This commit is contained in:
Matthias Kretschmann 2019-05-26 23:52:27 +02:00
parent d22e22806d
commit 896d1737d4
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 6 additions and 6 deletions

View File

@ -13,19 +13,19 @@ const Animation = posed.aside(fadeIn)
const ThemeToggle = ({ dark }) => ( const ThemeToggle = ({ dark }) => (
<span id="toggle" className={styles.checkboxContainer} aria-live="assertive"> <span id="toggle" className={styles.checkboxContainer} aria-live="assertive">
<Day className={dark ? null : 'active'} /> <Day className={!dark ? null : 'active'} />
<span className={styles.checkboxFake} /> <span className={styles.checkboxFake} />
<Night className={dark ? 'active' : null} /> <Night className={dark ? 'active' : null} />
</span> </span>
) )
ThemeToggle.propTypes = { ThemeToggle.propTypes = {
dark: PropTypes.bool dark: PropTypes.bool.isRequired
} }
const ThemeToggleInput = ({ dark, toggleDark }) => ( const ThemeToggleInput = ({ dark, toggleDark }) => (
<input <input
onChange={toggleDark()} onChange={() => toggleDark()}
type="checkbox" type="checkbox"
name="toggle" name="toggle"
value="toggle" value="toggle"
@ -35,8 +35,8 @@ const ThemeToggleInput = ({ dark, toggleDark }) => (
) )
ThemeToggleInput.propTypes = { ThemeToggleInput.propTypes = {
dark: PropTypes.bool, dark: PropTypes.bool.isRequired,
toggleDark: PropTypes.func toggleDark: PropTypes.func.isRequired
} }
export default class ThemeSwitch extends PureComponent { export default class ThemeSwitch extends PureComponent {

View File

@ -7,7 +7,7 @@ import { getCountry } from '../utils/getCountry'
export default class AppProvider extends PureComponent { export default class AppProvider extends PureComponent {
state = { state = {
dark: false, dark: false,
toggleDark: () => this.toggleDark, toggleDark: () => this.toggleDark(),
geolocation: null geolocation: null
} }