-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathActionButtons.tsx
59 lines (52 loc) · 1.71 KB
/
ActionButtons.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
import React, { FC, useCallback } from "react";
import data from "../../../../data/2023.json";
import Button from "../../../../components/UI/Button";
import styled from "styled-components";
import { BIG_BREAKPOINT } from "../../../../constants/BreakPoints";
import { gaEventTracker } from "../../../../components/analytics/Analytics";
import { useDateInterval } from "../../../../hooks/useDateInterval";
import { useUrlBuilder } from "../../../../services/urlBuilder";
const StyledActionDiv = styled.div`
display: flex;
text-align: center;
@media (max-width: ${BIG_BREAKPOINT}px) {
flex-direction: column;
width: 75%;
}
`;
const ActionButtons: FC<React.PropsWithChildren<unknown>> = () => {
const { isTicketsDisabled, isSponsorDisabled, isCfpDisabled } =
useDateInterval(new Date(), data);
const trackSponsorshipInfo = useCallback(() => {
gaEventTracker("sponsorship", "sponsorship");
}, []);
const trackTickets = useCallback(() => {
gaEventTracker("ticket", "tickets");
}, []);
const trackCFP = useCallback(() => {
gaEventTracker("CFP", "CFP");
}, []);
return (
<StyledActionDiv>
<Button
onClick={trackTickets}
text="🎟️ Buy Tickets"
link={useUrlBuilder("https://tickets.devbcn.com/event/devbcn-2023")}
disabled={isTicketsDisabled}
/>
<Button
onClick={trackCFP}
text="📢 Call For Papers"
link={data.cfp.link}
disabled={isCfpDisabled}
/>
<Button
onClick={trackSponsorshipInfo}
text="🤝 Sponsorship"
link="mailto:[email protected]?subject=devBcn sponsorship"
disabled={isSponsorDisabled}
/>
</StyledActionDiv>
);
};
export default ActionButtons;