This commit is contained in:
2024-10-28 16:16:53 +05:00
parent 77aabed207
commit d6809ff538
30 changed files with 1250 additions and 658 deletions
+5 -5
View File
@@ -10,18 +10,18 @@ import { useClickAway } from "@uidotdev/usehooks";
function Menu() {
const [isShow, setIsShow] = useState<boolean>(false);
const { user, setAccessToken } = useAuthStore();
const { user, setUser } = useAuthStore();
const ref = useClickAway<HTMLDivElement>(() => {
setIsShow(false);
});
function logout() {
setAccessToken(null);
setUser(null);
}
return (
<div>
<span className="relative cursor-pointer z-20">
<span className="relative z-20 cursor-pointer">
<button
onClick={() => setIsShow(true)}
className={`p-3 transition-colors relative z-20 ${
@@ -37,7 +37,7 @@ function Menu() {
<Transition in={isShow} timeout={150} mountOnEnter unmountOnExit>
{(state) => (
<div className={`transition-opacity ${state}`}>
<div className="absolute top-0 left-0 w-full h-full bg-black bg-opacity-10 z-10"></div>
<div className="absolute top-0 left-0 z-10 w-full h-full bg-black bg-opacity-10"></div>
<div ref={ref} className="absolute z-20 ml-2 mt-3.5">
<div className="relative">
<svg
@@ -62,7 +62,7 @@ function Menu() {
</div>
<div className="space-y-1 text-center">
<p className="text-sm">{user?.name}</p>
<p className="text-[#77828C] text-xs">{user?.username}</p>
<p className="text-[#77828C] text-xs">{user?.role}</p>
</div>
</div>
<div className="border-b border-[#DAE0E5] py-3 space-y-2">