|
1 | | -import { VStack, HStack, Heading } from "@chakra-ui/react"; |
| 1 | +import { VStack, HStack, Heading, Button } from "@chakra-ui/react"; |
2 | 2 | import AccessibleLink from "@/components/AccessibleLink"; |
3 | | -import Instagram from "../icons/Instagram"; |
4 | | -import Spotify from "../icons/Spotify"; |
5 | | -import Twitter from "../icons/Twitter"; |
6 | | -import Youtube from "../icons/Youtube"; |
| 3 | +import splitbee from "@splitbee/web"; |
| 4 | +import { SPLITBEE_EVENTS_NAME } from "constants/eventSplitbee"; |
| 5 | +import { SOCIAL_MEDIA } from '../../constants/data'; |
| 6 | +import { Instagram, Spotify, Twitter, Youtube} from '../icons/index'; |
7 | 7 |
|
8 | 8 | const FollowUs = () => { |
| 9 | + const renderIcon = (type: string) => { |
| 10 | + switch (type) { |
| 11 | + case "instagram": |
| 12 | + return <Instagram boxSize="64px" color="pink.500" /> |
| 13 | + case "spotify": |
| 14 | + return <Spotify boxSize="64px" color="pink.500" /> |
| 15 | + case "twitter": |
| 16 | + return <Twitter width="60px" height="64px" color="pink.500" /> |
| 17 | + case "youtube": |
| 18 | + return <Youtube width="92px" height="64px" color="pink.500" /> |
| 19 | + default: |
| 20 | + break; |
| 21 | + } |
| 22 | + } |
| 23 | + |
| 24 | + const renderItem = (item:any, index: number) => { |
| 25 | + return ( |
| 26 | + <AccessibleLink |
| 27 | + key={index} |
| 28 | + href={item.link} |
| 29 | + isExternal |
| 30 | + aria-label={item.label} |
| 31 | + onClick={()=> splitbee.track(SPLITBEE_EVENTS_NAME.EXTERNAL_LINK, {type: item.label, link:item.link})} |
| 32 | + > |
| 33 | + {renderIcon(item.label)} |
| 34 | + </AccessibleLink> |
| 35 | + ); |
| 36 | + }; |
| 37 | + |
9 | 38 | return ( |
10 | 39 | <VStack spacing="64px" as="section" mb="140px" id="sosial-media"> |
11 | 40 | <Heading variant="h1" as="h1" color="black.primary"> |
12 | 41 | Follow Us |
13 | 42 | </Heading> |
14 | 43 | <HStack minW="555px" spacing="111px"> |
15 | | - <AccessibleLink |
16 | | - href="https://instagram.com/_logosid" |
17 | | - isExternal |
18 | | - aria-label="Instagram" |
19 | | - > |
20 | | - <Instagram boxSize="64px" color="pink.500" /> |
21 | | - </AccessibleLink> |
22 | | - <AccessibleLink |
23 | | - href="https://open.spotify.com/show/2bwe0dyWnFKmqXaYCSwhML?si=VflhXjXRQqCL0VTVTO2_Zw&nd=1" |
24 | | - isExternal |
25 | | - aria-label="Spotify" |
26 | | - > |
27 | | - <Spotify boxSize="64px" color="pink.500" /> |
28 | | - </AccessibleLink> |
29 | | - <AccessibleLink |
30 | | - href="https://twitter.com/logos_id" |
31 | | - isExternal |
32 | | - aria-label="Twitter" |
33 | | - > |
34 | | - <Twitter width="60px" height="64px" color="pink.500" /> |
35 | | - </AccessibleLink> |
36 | | - <AccessibleLink |
37 | | - href="https://www.youtube.com/channel/UCh3AnUWH0gaiRi-ibilRj2Q" |
38 | | - isExternal |
39 | | - aria-label="Youtube" |
40 | | - > |
41 | | - <Youtube width="92px" height="64px" color="pink.500" /> |
42 | | - </AccessibleLink> |
| 44 | + {SOCIAL_MEDIA.map((item, index)=>renderItem(item, index))} |
43 | 45 | </HStack> |
44 | 46 | </VStack> |
45 | 47 | ); |
|
0 commit comments