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

View File

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