layout redesign
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import { useState } from 'react';
|
||||
import { logout as apiLogout } from '../../lib/api';
|
||||
|
||||
export default function LogoutButton() {
|
||||
const [busy, setBusy] = useState(false);
|
||||
|
||||
async function handleClick() {
|
||||
if (busy) return;
|
||||
setBusy(true);
|
||||
try {
|
||||
await apiLogout();
|
||||
} catch {
|
||||
/* clear UI anyway */
|
||||
}
|
||||
window.location.href = '/';
|
||||
}
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleClick}
|
||||
disabled={busy}
|
||||
title="Sign out"
|
||||
aria-label="Sign out"
|
||||
className="text-subtext0 hover:text-red transition-colors p-1.5 rounded-md hover:bg-surface0/60 disabled:opacity-50"
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" />
|
||||
<polyline points="16 17 21 12 16 7" />
|
||||
<line x1="21" x2="9" y1="12" y2="12" />
|
||||
</svg>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user