-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathConnectView.tsx
147 lines (129 loc) · 3.7 KB
/
ConnectView.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
import styled from "styled-components";
import Image from "next/image";
import { useState } from "react";
import DiscordLogo from "../../../../public/assets/socials/discord_coloured.svg";
import FacebookLogo from "../../../../public/assets/socials/facebook_coloured.svg";
import InstagramLogo from "../../../../public/assets/socials/instagram_coloured.svg";
import YoutubeLogo from "../../../../public/assets/socials/youtube_coloured.svg";
import SpotifyLogo from "../../../../public/assets/socials/spotify_coloured.svg";
import DiscordScreenshot from "../../../../public/assets/csesoc_discord.png";
import FacebookScreenshot from "../../../../public/assets/csesoc_facebook.png";
import InstagramScreenshot from "../../../../public/assets/csesoc_instagram.png";
import YoutubeScreenshot from "../../../../public/assets/csesoc_youtube.png";
import SpotifyScreenshot from "../../../../public/assets/csesoc_spotify.png";
import { device } from "../../../styles/device";
const MainContainer = styled.div`
display: flex;
flex-direction: column-reverse;
justify-content: center;
flex: 1;
gap: 2rem;
width: 100%;
`;
const PreviewWrapper = styled.div`
width: 100%;
max-width: 1024px;
margin: 0 auto;
`;
const Preview = styled.div`
position: relative;
padding-bottom: calc(9 / 16 * 100%);
border-radius: 4px;
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
overflow: hidden;
`;
const SocialIcons = styled.div`
display: flex;
justify-content: center;
gap: 0.5rem;
@media ${device.tablet} {
gap: 2rem;
}
`;
const SocialIconImageContainer = styled.div`
position: relative;
height: 40px;
width: 40px;
@media ${device.tablet} {
height: 60px;
width: 60px;
}
`;
const Button = styled.button<{ active?: boolean }>`
display: flex;
align-items: center;
justify-content: center;
background: none;
border: none;
cursor: pointer;
border-radius: 100%;
padding: 0.5rem;
${({ active }) =>
active &&
`
box-shadow: 0 0 0 4px var(--primary-purple);
`}
@media ${device.tablet} {
padding: 1rem;
}
`;
const socialIcons = [
{
name: "Discord",
icon: DiscordLogo,
link: "https://cseso.cc/discord",
screenshot: DiscordScreenshot,
},
{
name: "Facebook",
icon: FacebookLogo,
link: "https://cseso.cc/fb",
screenshot: FacebookScreenshot,
},
{
name: "Instagram",
icon: InstagramLogo,
link: "https://www.instagram.com/csesoc_unsw/",
screenshot: InstagramScreenshot,
},
{
name: "YouTube",
icon: YoutubeLogo,
link: "https://cseso.cc/youtube",
screenshot: YoutubeScreenshot,
},
{
name: "Spotify",
icon: SpotifyLogo,
link: "https://open.spotify.com/show/2h9OxTkeKNznIfNqMMYcxj?si=5d6ccc6881a14d5f",
screenshot: SpotifyScreenshot,
},
];
export default function ConnectView() {
const [activeTab, setActiveTab] = useState(socialIcons[0].name);
return (
<MainContainer>
<SocialIcons>
{socialIcons.map(({ name, icon }) => (
<Button active={name === activeTab} key={name} onClick={() => setActiveTab(name)}>
<SocialIconImageContainer>
<Image src={icon.src} alt={name} objectFit="contain" layout="fill" />
</SocialIconImageContainer>
</Button>
))}
</SocialIcons>
<PreviewWrapper>
<Preview>
{socialIcons.map(
({ name, screenshot, link }) =>
name === activeTab && (
<a href={link} target="_blank" rel="noreferrer">
<Image layout="fill" objectFit="cover" src={screenshot.src} alt={name} />
</a>
),
)}
</Preview>
</PreviewWrapper>
</MainContainer>
);
}