fix: change theme mode
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import {useState, useEffect, useRef} from 'react'
|
import {useState, useEffect, useRef} from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import {styled, useTheme} from '@mui/material/styles'
|
import {styled, useTheme, useColorScheme} from '@mui/material/styles'
|
||||||
import Box from '@mui/material/Box'
|
import Box from '@mui/material/Box'
|
||||||
import Typography from '@mui/material/Typography'
|
import Typography from '@mui/material/Typography'
|
||||||
import Slider from '@mui/material/Slider'
|
import Slider from '@mui/material/Slider'
|
||||||
@@ -73,6 +73,7 @@ export default function Lekte({audio, url, parole}) {
|
|||||||
const isReady = useRef(false)
|
const isReady = useRef(false)
|
||||||
const {duration} = audioRef.current
|
const {duration} = audioRef.current
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
|
const {mode} = useColorScheme()
|
||||||
const [position, setPosition] = useState(0)
|
const [position, setPosition] = useState(0)
|
||||||
const [volume, setVolume] = useState(100)
|
const [volume, setVolume] = useState(100)
|
||||||
const [isPlaying, setIsPlaying] = useState(false)
|
const [isPlaying, setIsPlaying] = useState(false)
|
||||||
@@ -89,8 +90,8 @@ export default function Lekte({audio, url, parole}) {
|
|||||||
return `${minute}:${secondLeft <= 9 ? `0${secondLeft}` : secondLeft}`
|
return `${minute}:${secondLeft <= 9 ? `0${secondLeft}` : secondLeft}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const mainIconColor = theme.palette.mode === 'dark' ? '#fff' : '#000'
|
const mainIconColor = mode === 'dark' ? '#fff' : '#000'
|
||||||
const lightIconColor = theme.palette.mode === 'dark' ? 'rgba(255,255,255,0.4)' : grey[900]
|
const lightIconColor = mode === 'dark' ? 'rgba(255,255,255,0.4)' : grey[900]
|
||||||
|
|
||||||
const startTimer = () => {
|
const startTimer = () => {
|
||||||
clearInterval(intervalRef.current)
|
clearInterval(intervalRef.current)
|
||||||
|
|||||||
Reference in New Issue
Block a user