Skip to content

Commit 4c4d545

Browse files
committed
feat(web): court-badges
1 parent 80ac304 commit 4c4d545

File tree

5 files changed

+79
-33
lines changed

5 files changed

+79
-33
lines changed

web/.env.devnet.public

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ export REACT_APP_CORE_SUBGRAPH=https://api.studio.thegraph.com/query/61738/klero
44
export REACT_APP_DRT_ARBSEPOLIA_SUBGRAPH=https://api.studio.thegraph.com/query/61738/kleros-v2-drt-arbisep-devnet/version/latest
55
export REACT_APP_STATUS_URL=https://kleros-v2-devnet.betteruptime.com/badge
66
export REACT_APP_GENESIS_BLOCK_ARBSEPOLIA=3084598
7+
export REACT_APP_ARBITRATOR_TYPE="neo"

web/src/layout/Header/DesktopHeader.tsx

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
11
import React from "react";
22
import styled, { css } from "styled-components";
3-
4-
import { Link } from "react-router-dom";
3+
import { landscapeStyle } from "styles/landscapeStyle";
54
import { useToggle } from "react-use";
6-
7-
import KlerosCourtUniversityLogo from "svgs/header/kleros-court-university.svg";
8-
import KlerosCourtLogo from "svgs/header/kleros-court.svg";
9-
import KlerosSolutionsIcon from "svgs/menu-icons/kleros-solutions.svg";
10-
115
import { useLockOverlayScroll } from "hooks/useLockOverlayScroll";
12-
13-
import { isKlerosUniversity } from "src/consts";
14-
15-
import { landscapeStyle } from "styles/landscapeStyle";
16-
import { responsiveSize } from "styles/responsiveSize";
17-
6+
import KlerosSolutionsIcon from "svgs/menu-icons/kleros-solutions.svg";
187
import ConnectWallet from "components/ConnectWallet";
198
import LightButton from "components/LightButton";
209
import { Overlay } from "components/Overlay";
@@ -26,6 +15,8 @@ import Help from "./navbar/Menu/Help";
2615
import Settings from "./navbar/Menu/Settings";
2716

2817
import { PopupContainer } from ".";
18+
import { responsiveSize } from "styles/responsiveSize";
19+
import Logo from "./Logo";
2920

3021
const Container = styled.div`
3122
display: none;
@@ -73,10 +64,6 @@ const LightButtonContainer = styled.div`
7364
margin-right: ${responsiveSize(12, 16)};
7465
`;
7566

76-
const StyledLink = styled(Link)`
77-
min-height: 48px;
78-
`;
79-
8067
const StyledKlerosSolutionsIcon = styled(KlerosSolutionsIcon)`
8168
fill: ${({ theme }) => theme.white} !important;
8269
`;
@@ -106,7 +93,7 @@ const DesktopHeader = () => {
10693
Icon={StyledKlerosSolutionsIcon}
10794
/>
10895
</LightButtonContainer>
109-
<StyledLink to={"/"}>{isKlerosUniversity() ? <KlerosCourtUniversityLogo /> : <KlerosCourtLogo />}</StyledLink>
96+
<Logo />
11097
</LeftSide>
11198

11299
<MiddleSide>

web/src/layout/Header/Logo.tsx

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import React from "react";
2+
import { Link } from "react-router-dom";
3+
import styled, { Theme, useTheme } from "styled-components";
4+
import KlerosCourtLogo from "svgs/header/kleros-court.svg";
5+
6+
const arbitratorType = process.env.REACT_APP_ARBITRATOR_TYPE;
7+
8+
const Container = styled.div`
9+
display: flex;
10+
flex-direction: row;
11+
align-items: center;
12+
gap: 16px;
13+
`;
14+
15+
const StyledLink = styled(Link)`
16+
min-height: 48px;
17+
`;
18+
19+
const BadgeContainer = styled.div<{ backgroundColor: string }>`
20+
transform: skewX(-15deg);
21+
background-color: ${({ backgroundColor }) => backgroundColor};
22+
border-radius: 3px;
23+
padding: 1px 8px;
24+
height: fit-content;
25+
`;
26+
27+
const BadgeText = styled.label`
28+
color: #220050;
29+
`;
30+
31+
const Badge: React.FC<{ text: string; color: keyof Theme }> = ({ text, color }) => {
32+
const theme = useTheme();
33+
return (
34+
<BadgeContainer {...{ backgroundColor: theme[color] }}>
35+
<BadgeText>{text}</BadgeText>
36+
</BadgeContainer>
37+
);
38+
};
39+
40+
const Logo: React.FC = () => {
41+
let CourtBadge: JSX.Element | null = null;
42+
switch (arbitratorType) {
43+
case "neo":
44+
CourtBadge = <Badge text="Neo" color="paleCyan" />;
45+
break;
46+
case "university":
47+
CourtBadge = <Badge text="Uni" color="limeGreen" />;
48+
break;
49+
default:
50+
break;
51+
}
52+
53+
return (
54+
<Container>
55+
{" "}
56+
<StyledLink to={"/"}>
57+
<KlerosCourtLogo />
58+
</StyledLink>
59+
{CourtBadge}
60+
</Container>
61+
);
62+
};
63+
64+
export default Logo;

web/src/layout/Header/MobileHeader.tsx

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
11
import React, { useContext, useMemo, useRef } from "react";
22
import styled, { css } from "styled-components";
3-
4-
import { Link } from "react-router-dom";
53
import { useClickAway, useToggle } from "react-use";
6-
7-
import HamburgerIcon from "svgs/header/hamburger.svg";
8-
import KlerosCourtUniversityLogo from "svgs/header/kleros-court-university.svg";
9-
import KlerosCourtLogo from "svgs/header/kleros-court.svg";
10-
11-
import { isKlerosUniversity } from "src/consts";
12-
134
import { landscapeStyle } from "styles/landscapeStyle";
14-
5+
import HamburgerIcon from "svgs/header/hamburger.svg";
156
import LightButton from "components/LightButton";
167

178
import NavBar from "./navbar";
9+
import Logo from "./Logo";
1810

1911
const Container = styled.div`
2012
display: flex;
@@ -41,10 +33,6 @@ const StyledLightButton = styled(LightButton)`
4133
}
4234
`;
4335

44-
const StyledLink = styled(Link)`
45-
min-height: 48px;
46-
`;
47-
4836
const OpenContext = React.createContext({
4937
isOpen: false,
5038
toggleIsOpen: () => {
@@ -64,7 +52,7 @@ const MobileHeader = () => {
6452
return (
6553
<Container ref={containerRef}>
6654
<OpenContext.Provider value={memoizedContext}>
67-
<StyledLink to={"/"}>{isKlerosUniversity() ? <KlerosCourtUniversityLogo /> : <KlerosCourtLogo />}</StyledLink>
55+
<Logo />
6856
<NavBar />
6957
<StyledLightButton text="" Icon={HamburgerIcon} onClick={toggleIsOpen} />
7058
</OpenContext.Provider>

web/src/styles/themes.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ export const lightTheme = {
4141

4242
skeletonBackground: "#EBEBEB",
4343
skeletonHighlight: "#F5F5F5",
44+
45+
paleCyan: "#ACFFFF",
46+
limeGreen: "#F3FFD9",
4447
};
4548

4649
export const darkTheme = {
@@ -84,4 +87,7 @@ export const darkTheme = {
8487

8588
skeletonBackground: "#3A2270",
8689
skeletonHighlight: "#3E307C",
90+
91+
paleCyan: "#ACFFFF",
92+
limeGreen: "#F3FFD9",
8793
};

0 commit comments

Comments
 (0)