1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

default theme fix

This commit is contained in:
Matthias Kretschmann 2020-10-30 22:34:39 +01:00
parent d655adb9f7
commit 983bc3a902
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -1,4 +1,4 @@
import React, { ChangeEvent, ReactElement, useEffect, useState } from 'react' import React, { ReactElement } from 'react'
import { DarkMode } from 'use-dark-mode' import { DarkMode } from 'use-dark-mode'
import Input from '../../atoms/Input' import Input from '../../atoms/Input'
@ -9,18 +9,7 @@ export default function Theme({
}: { }: {
darkMode: DarkMode darkMode: DarkMode
}): ReactElement { }): ReactElement {
const initialValue = darkMode.value ? options[2] : options[1] const value = darkMode.value === true ? options[2] : options[1]
const [value, setValue] = useState(initialValue)
useEffect(() => {
switch (value) {
case 'Light':
darkMode.disable()
return
case 'Dark':
darkMode.enable()
}
}, [value, darkMode])
return ( return (
<li> <li>
@ -31,9 +20,7 @@ export default function Theme({
type="select" type="select"
options={options} options={options}
value={value} value={value}
onChange={(e: ChangeEvent<HTMLSelectElement>) => onChange={() => darkMode.toggle()}
setValue(e.target.value)
}
small small
/> />
</li> </li>