2023-07-22 13:06:28 +04:00
|
|
|
'use client'
|
|
|
|
|
|
2023-07-24 23:12:52 +04:00
|
|
|
import {styled, useColorScheme} from '@mui/material/styles'
|
2023-07-22 13:06:28 +04:00
|
|
|
import LightModeIcon from '@mui/icons-material/LightMode'
|
|
|
|
|
import DarkModeIcon from '@mui/icons-material/DarkMode'
|
|
|
|
|
import {Box} from '@mui/material'
|
|
|
|
|
import {usePathname} from 'next/navigation'
|
|
|
|
|
|
|
|
|
|
const PREFIX = 'chanje-tem'
|
|
|
|
|
|
|
|
|
|
const klas = {
|
|
|
|
|
chanje: `${PREFIX}-chanje`,
|
|
|
|
|
chanjeFiks: `${PREFIX}-chanjeFiks`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const StyledBox = styled(Box)({
|
|
|
|
|
[`& .${klas.chanje}`]: {
|
|
|
|
|
position: 'absolute',
|
|
|
|
|
right: '1em',
|
|
|
|
|
top: '60px',
|
|
|
|
|
zIndex: 1,
|
|
|
|
|
cursor: 'pointer'
|
|
|
|
|
},
|
|
|
|
|
[`& .${klas.chanjeFiks}`]: {
|
|
|
|
|
position: 'fixed',
|
|
|
|
|
right: '0.5em',
|
|
|
|
|
top: '68px',
|
|
|
|
|
zIndex: 2,
|
|
|
|
|
cursor: 'pointer'
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
export default function ChanjeTem() {
|
2023-07-24 23:12:52 +04:00
|
|
|
const {mode, setMode} = useColorScheme()
|
2023-07-22 13:06:28 +04:00
|
|
|
const pathname = usePathname()
|
|
|
|
|
const selectedPath = pathname === '/' ? 'akey' : pathname.split('/')[1]
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<StyledBox>
|
|
|
|
|
<div className={selectedPath === 'paroles' ? klas.chanjeFiks : klas.chanje} >
|
2023-07-24 23:12:52 +04:00
|
|
|
{mode === 'dark' ? (
|
|
|
|
|
<LightModeIcon onClick={() => setMode(mode === 'light' ? 'dark' : 'light')} />
|
2023-07-22 13:06:28 +04:00
|
|
|
) : (
|
2023-07-24 23:12:52 +04:00
|
|
|
<DarkModeIcon onClick={() => setMode(mode === 'light' ? 'dark' : 'light')} />
|
2023-07-22 13:06:28 +04:00
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</StyledBox>
|
|
|
|
|
)
|
|
|
|
|
}
|