2021-04-13 09:51:42 -07:00
|
|
|
import { LockClosedIcon, LockOpenIcon } from '@heroicons/react/outline'
|
|
|
|
import useMangoStore from '../stores/useMangoStore'
|
|
|
|
|
|
|
|
const UiLock = ({ className = '' }) => {
|
|
|
|
const set = useMangoStore((s) => s.set)
|
|
|
|
const uiLocked = useMangoStore((s) => s.settings.uiLocked)
|
|
|
|
|
|
|
|
const handleClick = () => {
|
|
|
|
set((state) => {
|
|
|
|
state.settings.uiLocked = !uiLocked
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={`flex relative ${className}`}>
|
|
|
|
<button
|
|
|
|
onClick={handleClick}
|
2021-04-14 23:16:36 -07:00
|
|
|
className="w-10 h-10 flex items-center justify-center bg-transparent rounded hover:text-th-primary focus:outline-none"
|
2021-04-13 09:51:42 -07:00
|
|
|
>
|
2021-04-14 05:01:58 -07:00
|
|
|
{uiLocked ? (
|
|
|
|
<LockClosedIcon className="w-5 h-5" />
|
|
|
|
) : (
|
2021-04-14 23:16:36 -07:00
|
|
|
<LockOpenIcon className="w-5 h-5 animate-bounce" />
|
2021-04-14 05:01:58 -07:00
|
|
|
)}
|
2021-04-13 09:51:42 -07:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default UiLock
|