-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathAppHeader.tsx
51 lines (47 loc) · 1.36 KB
/
AppHeader.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { Burger, Button, Flex } from "@mantine/core";
import { useNavigate } from "react-router";
import { shortAddress } from "@/helpers/address";
import { useClient } from "@/hooks/useClient";
import { Actions } from "./Actions";
import classes from "./AppHeader.module.css";
import { Connection } from "./Connection";
export type AppHeaderProps = {
collapsed?: boolean;
opened: boolean;
toggle: () => void;
};
export const AppHeader: React.FC<AppHeaderProps> = ({
collapsed,
opened,
toggle,
}) => {
const { client } = useClient();
const navigate = useNavigate();
const handleClick = () => {
void navigate("/identity");
};
return (
<Flex align="center">
<Flex align="center" gap="md" p="md" w={{ base: 300, lg: 420 }}>
{!collapsed && (
<Burger opened={opened} onClick={toggle} hiddenFrom="sm" size="sm" />
)}
<Flex align="center" flex={1}>
{client && (
<Button
variant="default"
aria-label={client.accountAddress}
className={classes.button}
onClick={handleClick}>
{shortAddress(client.accountAddress)}
</Button>
)}
</Flex>
</Flex>
<Flex align="center" justify="space-between" gap="xs" p="md" flex={1}>
<Actions />
<Connection />
</Flex>
</Flex>
);
};