Skip to content

Commit 6ecb5ff

Browse files
committed
refactor: centralize ActionButtons component and remove redundant tests from year-specific directories.
1 parent 32e41df commit 6ecb5ff

13 files changed

Lines changed: 100 additions & 423 deletions

File tree

src/2023/Cfp/CfpSection2023.test.tsx

Lines changed: 0 additions & 115 deletions
This file was deleted.

src/2023/Home/components/ActionButtons/ActionButtons.tsx

Lines changed: 0 additions & 59 deletions
This file was deleted.

src/2023/Home/components/Home/Home.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ import {
1414
StyleHomeContainer,
1515
} from "./Style.Home";
1616
import { useWindowSize } from "react-use";
17+
import { useDateInterval } from "@hooks/useDateInterval";
1718
import { SectionWrapper } from "@components/SectionWrapper/SectionWrapper";
18-
import ActionButtons from "../ActionButtons/ActionButtons";
19+
import ActionButtons from "@views/Home/components/ActionButtons/ActionButtons";
1920
import { styled } from "styled-components";
2021
import { Color } from "@styles/colors";
2122
import InfoButtons from "../InfoButtons/InfoButtons";
@@ -33,6 +34,8 @@ const StyledLogo = styled.img`
3334
`;
3435
const Home: FC<React.PropsWithChildren<unknown>> = () => {
3536
const { width } = useWindowSize();
37+
const { isTicketsDisabled, isSponsorDisabled, isCfpDisabled } =
38+
useDateInterval(new Date(), data);
3639
const startDay = data.startDay;
3740

3841
return (
@@ -79,7 +82,17 @@ const Home: FC<React.PropsWithChildren<unknown>> = () => {
7982
renderer={TimeCountDown}
8083
/>
8184
)}
82-
{data.actionButtons && <ActionButtons />}
85+
{data.actionButtons && (
86+
<ActionButtons
87+
isTicketsDisabled={isTicketsDisabled}
88+
isCfpDisabled={isCfpDisabled}
89+
isSponsorDisabled={isSponsorDisabled}
90+
ticketsStartDay={data.tickets.startDay}
91+
cfpStartDay={data.cfp.startDay}
92+
cfpLink={data.cfp.link}
93+
edition={data.edition}
94+
/>
95+
)}
8396
{data.showInfoButtons && <InfoButtons />}
8497
<h2 style={{ color: Color.LIGHT_BLUE, textShadow: "1px 1px #000" }}>
8598
DevBcn 2023 edition resources

src/2024/Cfp/CfpSection.test.tsx

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/2024/Cfp/TrackComponent.test.tsx

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/2024/Home/Home.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Countdown from "react-countdown";
22
import React, { FC } from "react";
33
import { useWindowSize } from "react-use";
4+
import { useDateInterval } from "@hooks/useDateInterval";
45
import {
56
StyledBlueSlash,
67
StyledBottomSlash,
@@ -31,6 +32,8 @@ import TimeCountDown from "@views/Home/components/Home/components/TimeCountdown"
3132

3233
const Home: FC<React.PropsWithChildren<unknown>> = () => {
3334
const { width } = useWindowSize();
35+
const { isTicketsDisabled, isSponsorDisabled, isCfpDisabled } =
36+
useDateInterval(new Date(), data);
3437

3538
return (
3639
<StyledHomeImage>
@@ -92,7 +95,17 @@ const Home: FC<React.PropsWithChildren<unknown>> = () => {
9295
renderer={TimeCountDown}
9396
/>
9497
)}
95-
{data?.actionButtons && <ActionButtons />}
98+
{data?.actionButtons && (
99+
<ActionButtons
100+
isTicketsDisabled={isTicketsDisabled}
101+
isCfpDisabled={isCfpDisabled}
102+
isSponsorDisabled={isSponsorDisabled}
103+
ticketsStartDay={data.tickets.startDay}
104+
cfpStartDay={data.cfp.startDay}
105+
cfpLink={data.cfp.link}
106+
edition={data.edition}
107+
/>
108+
)}
96109
{data?.showInfoButtons && <InfoButtons />}
97110

98111
{width > BIGGER_BREAKPOINT && (

src/2024/Home/components/ActionButtons.tsx

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)