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:
parent
d22e22806d
commit
896d1737d4
@ -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 {
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user