-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathExplore.tsx
83 lines (68 loc) · 1.73 KB
/
Explore.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import React from "react";
import styled, { css } from "styled-components";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { landscapeStyle } from "styles/landscapeStyle";
import { responsiveSize } from "styles/responsiveSize";
import { useOpenContext } from "../MobileHeader";
const Container = styled.div`
display: flex;
gap: 0px;
flex-direction: column;
${landscapeStyle(
() => css`
flex-direction: row;
gap: ${responsiveSize(4, 16)};
`
)};
`;
const LinkContainer = styled.div`
display: flex;
min-height: 32px;
align-items: center;
`;
const Title = styled.h1`
display: block;
${landscapeStyle(
() => css`
display: none;
`
)};
`;
const StyledLink = styled(Link)<{ $isActive: boolean }>`
color: ${({ theme }) => theme.klerosUIComponentsPrimaryText};
text-decoration: none;
font-size: 16px;
font-weight: ${({ $isActive }) => ($isActive ? "600" : "normal")};
${landscapeStyle(
() => css`
color: ${({ theme }) => theme.klerosUIComponentsWhite};
`
)};
`;
const links = [
{ to: "/", text: "Home" },
{ to: "/dispute-template", text: "Dispute Preview" },
{ to: "/ruler", text: "Configure Ruler" },
];
const Explore: React.FC = () => {
const pathname = usePathname();
const { toggleIsOpen } = useOpenContext();
return (
<Container>
<Title>Explore</Title>
{links.map(({ to, text }) => (
<LinkContainer key={text}>
<StyledLink
href={to}
onClick={toggleIsOpen}
$isActive={to === "/" ? pathname === "/" : pathname.startsWith(to)}
>
{text}
</StyledLink>
</LinkContainer>
))}
</Container>
);
};
export default Explore;