mango-ui-v2/components/UiLock.tsx

31 lines
830 B
TypeScript
Raw Normal View History

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"
>
{uiLocked ? (
<LockClosedIcon className="w-5 h-5" />
) : (
2021-04-14 23:16:36 -07:00
<LockOpenIcon className="w-5 h-5 animate-bounce" />
)}
</button>
</div>
)
}
export default UiLock