Skip to content

Commit fd27433

Browse files
committed
feat(web): community section like figma desktop
1 parent 51ef929 commit fd27433

File tree

3 files changed

+40
-88
lines changed

3 files changed

+40
-88
lines changed

web/src/consts/community-elements.tsx

Lines changed: 9 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
import React from "react";
22
import styled, { css } from "styled-components";
3-
import { IElement } from "../pages/home/Community/Element";
3+
import { IElement } from "../pages/Home/Community/Element";
44
import PNKIcon from "svgs/icons/pnk.svg";
55
import SnapshotIcon from "svgs/icons/snapshot-color.svg";
66
import FrenchFlagIcon from "svgs/icons/french-flag.svg";
7-
import PhoneIcon from "svgs/icons/phone.svg";
8-
import ChatIcon from "svgs/icons/chat.svg";
9-
import DiscordIcon from "svgs/socialmedia/discord.svg";
107
import TelegramIcon from "svgs/socialmedia/telegram.svg";
11-
import SlackIcon from "svgs/socialmedia/slack.svg";
128

139
const StyledLabel = styled.label`
1410
color: ${({ theme }) => theme.primaryBlue};
@@ -25,34 +21,17 @@ const StyledPNKIcon = styled(PNKIcon)`
2521
${fillWithSecondaryPurple}
2622
`;
2723

28-
const StyledPhoneIcon = styled(PhoneIcon)`
29-
${fillWithSecondaryPurple}
30-
`;
31-
32-
const StyledChatIcon = styled(ChatIcon)`
33-
${fillWithSecondaryPurple}
34-
`;
35-
3624
const fillWithPrimaryBlue = css`
3725
fill: ${({ theme }) => theme.primaryBlue};
3826
`;
3927

40-
const StyledDiscordIcon = styled(DiscordIcon)`
41-
${fillWithPrimaryBlue}
42-
`;
43-
4428
const StyledTelegramIcon = styled(TelegramIcon)`
4529
${fillWithPrimaryBlue}
4630
`;
4731

48-
const StyledSlackIcon = styled(SlackIcon)`
49-
${fillWithPrimaryBlue}
50-
`;
51-
52-
export const firstSection: IElement[] = [
32+
export const section: IElement[] = [
5333
{
5434
Icon: StyledPNKIcon,
55-
primaryText: "Join the discussions",
5635
urls: [
5736
{
5837
node: <StyledLabel>Kleros Forum</StyledLabel>,
@@ -62,51 +41,29 @@ export const firstSection: IElement[] = [
6241
},
6342
{
6443
Icon: SnapshotIcon,
65-
primaryText: "Vote on proposals",
6644
urls: [
6745
{
68-
node: <StyledLabel>Snapshot</StyledLabel>,
46+
node: <StyledLabel>Vote on proposals</StyledLabel>,
6947
link: "https://snapshot.org/#/kleros.eth/",
7048
},
7149
],
7250
},
7351
{
74-
Icon: FrenchFlagIcon,
52+
Icon: StyledTelegramIcon,
53+
primaryText: "Wednesday, 18h UTC",
7554
urls: [
7655
{
77-
node: <StyledLabel>Cooperative Kleros</StyledLabel>,
78-
link: "https://kleros.io/coop/",
79-
},
80-
],
81-
},
82-
];
83-
84-
export const secondSection: IElement[] = [
85-
{
86-
Icon: StyledPhoneIcon,
87-
primaryText: "Join the Community Call",
88-
urls: [
89-
{
90-
node: <StyledLabel>Join</StyledLabel>,
56+
node: <StyledLabel>Community Calls</StyledLabel>,
9157
link: "https://t.me/kleros",
9258
},
9359
],
9460
},
9561
{
96-
Icon: StyledChatIcon,
97-
primaryText: "Talk with us",
62+
Icon: FrenchFlagIcon,
9863
urls: [
9964
{
100-
node: <StyledDiscordIcon />,
101-
link: "https://discord.gg/MhXQGCyHd9",
102-
},
103-
{
104-
node: <StyledTelegramIcon />,
105-
link: "https://t.me/kleros",
106-
},
107-
{
108-
node: <StyledSlackIcon />,
109-
link: "https://kleros.slack.com/join/signup",
65+
node: <StyledLabel>Join the Coopérative</StyledLabel>,
66+
link: "https://kleros.io/coop/",
11067
},
11168
],
11269
},

web/src/pages/Home/Community/Element.tsx

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import styled from "styled-components";
44
const Container = styled.div`
55
display: flex;
66
gap: 8px;
7+
align-items: center;
8+
flex-wrap: wrap;
9+
justify-content: center;
710
811
svg {
912
width: 16px;
@@ -18,6 +21,12 @@ const Container = styled.div`
1821

1922
const StyledLabel = styled.label`
2023
color: ${({ theme }) => theme.primaryText};
24+
font-weight: 600;
25+
`;
26+
27+
const StyledA = styled.a`
28+
display: flex;
29+
align-items: center;
2130
`;
2231

2332
export interface IElement {
@@ -29,17 +38,18 @@ export interface IElement {
2938
export const Element: React.FC<IElement> = ({ primaryText, urls, Icon }) => (
3039
<Container>
3140
{Icon && <Icon />}
32-
{primaryText && (
33-
<>
34-
<StyledLabel>{primaryText}</StyledLabel> <StyledLabel>|</StyledLabel>
35-
</>
36-
)}
41+
3742
<div className="link-container">
3843
{urls.map(({ node, link }, i) => (
39-
<a key={i} href={link} target="_blank" rel="noreferrer">
44+
<StyledA key={i} href={link} target="_blank" rel="noreferrer">
4045
{node}
41-
</a>
46+
</StyledA>
4247
))}
4348
</div>
49+
{primaryText && (
50+
<>
51+
<StyledLabel>{primaryText}</StyledLabel>
52+
</>
53+
)}
4454
</Container>
4555
);

web/src/pages/Home/Community/index.tsx

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import styled, { css } from "styled-components";
33
import { landscapeStyle } from "styles/landscapeStyle";
44
import { Card } from "@kleros/ui-components-library";
55
import { Element } from "./Element";
6-
import { firstSection, secondSection } from "consts/community-elements";
6+
import { section } from "consts/community-elements";
77

88
const Container = styled.div`
99
margin-top: 64px;
@@ -16,17 +16,8 @@ const Container = styled.div`
1616
const StyledCard = styled(Card)`
1717
width: 100%;
1818
height: auto;
19-
`;
20-
21-
const StyledSeparator = styled.hr`
22-
margin: 0;
23-
`;
24-
25-
const Section = styled.div`
26-
width: 100%;
27-
gap: 8px;
19+
gap: 12px;
2820
flex-direction: column;
29-
height: auto;
3021
flex-wrap: wrap;
3122
padding: 12px;
3223
display: flex;
@@ -37,21 +28,23 @@ const Section = styled.div`
3728
() => css`
3829
flex-direction: row;
3930
justify-content: space-between;
40-
gap: 0px;
41-
padding: 0 32px;
42-
min-height: 64px;
31+
gap: 20px;
32+
padding: 24px 32px;
4333
`
4434
)}
4535
`;
4636

47-
const TwoElementContainer = styled.div`
37+
const ThreeElementContainer = styled.div`
4838
display: flex;
4939
flex-direction: column;
50-
gap: 8px;
40+
justify-content: center;
41+
align-items: center;
42+
gap: 12px;
5143
5244
${landscapeStyle(
5345
() => css`
5446
flex-direction: row;
47+
justify-content: space-between;
5548
gap: 48px;
5649
`
5750
)}
@@ -61,20 +54,12 @@ const Community = () => (
6154
<Container>
6255
<h1>Community</h1>
6356
<StyledCard>
64-
<Section>
65-
<TwoElementContainer>
66-
{firstSection.slice(0, 2).map((element) => (
67-
<Element key={element.primaryText} {...element} />
68-
))}
69-
</TwoElementContainer>
70-
<Element {...firstSection[2]} />
71-
</Section>
72-
<StyledSeparator />
73-
<Section>
74-
{secondSection.map((element) => (
75-
<Element key={element.primaryText} {...element} />
57+
<ThreeElementContainer>
58+
{section.slice(0, 3).map((element) => (
59+
<Element key={element.Icon} {...element} />
7660
))}
77-
</Section>
61+
</ThreeElementContainer>
62+
<Element {...section[3]} />
7863
</StyledCard>
7964
</Container>
8065
);

0 commit comments

Comments
 (0)