Updated user button to allow for children
This commit is contained in:
@@ -7,9 +7,10 @@ import {
|
|||||||
Separator,
|
Separator,
|
||||||
Spinner,
|
Spinner,
|
||||||
} from "@heroui/react";
|
} from "@heroui/react";
|
||||||
|
import type { PropsWithChildren } from "react";
|
||||||
import { useAuth } from "~/hooks/auth";
|
import { useAuth } from "~/hooks/auth";
|
||||||
|
|
||||||
export default function User() {
|
export default function User({ children }: PropsWithChildren) {
|
||||||
const { user, loading, login, logout } = useAuth();
|
const { user, loading, login, logout } = useAuth();
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
@@ -21,12 +22,17 @@ export default function User() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (user === null) {
|
if (user === null) {
|
||||||
return <Button onClick={() => login()}>Login</Button>;
|
return (
|
||||||
|
<Button onClick={() => login()}>
|
||||||
|
<Typography.Paragraph>{children}Login</Typography.Paragraph>
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dropdown>
|
<Dropdown>
|
||||||
<Button className="pr-0">
|
<Button className="pr-0">
|
||||||
|
{children}
|
||||||
<Typography.Paragraph>{user.name}</Typography.Paragraph>
|
<Typography.Paragraph>{user.name}</Typography.Paragraph>
|
||||||
<Avatar>
|
<Avatar>
|
||||||
<Avatar.Image alt="Avatar" src={user.avatar}></Avatar.Image>
|
<Avatar.Image alt="Avatar" src={user.avatar}></Avatar.Image>
|
||||||
|
|||||||
Reference in New Issue
Block a user