Skip to content

Commit 6795144

Browse files
committed
refactor: remove duplicated code. Fixes sonar issues
1 parent 7d75258 commit 6795144

File tree

4 files changed

+130
-336
lines changed

4 files changed

+130
-336
lines changed

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

+11-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
BIG_BREAKPOINT,
88
LARGE_BREAKPOINT,
99
} from "../../../../constants/BreakPoints";
10-
import TimeCountDown from "./components/TimeCountdown";
1110
import { useWindowSize } from "react-use";
1211
import {
1312
StyledBlueSlash,
@@ -27,6 +26,8 @@ import styled from "styled-components";
2726
import { Color } from "../../../../styles/colors";
2827
import InfoButtons from "../InfoButtons/InfoButtons";
2928
import MultimediaInfoButtons from "../MultimediaInfoButtons/MultimediaInfoButtons";
29+
import CountDownCompleted from "../../../../views/Home/components/Home/components/CountDownCompleted";
30+
import TimeCountDown from "../../../../views/Home/components/Home/components/TimeCountdown";
3031

3132
const StyledLogo = styled.img`
3233
margin: 20px;
@@ -77,7 +78,11 @@ const Home: FC<React.PropsWithChildren<unknown>> = () => {
7778
</StyledSubtitle>
7879
</StyledTitleContainer>
7980
{data.showCountdown && (
80-
<Countdown date={startDay} renderer={TimeCountDown} />
81+
<Countdown
82+
date={startDay}
83+
onComplete={CountDownCompleted}
84+
renderer={TimeCountDown}
85+
/>
8186
)}
8287
{data.actionButtons && <ActionButtons />}
8388
{data.showInfoButtons && <InfoButtons />}
@@ -93,7 +98,8 @@ const Home: FC<React.PropsWithChildren<unknown>> = () => {
9398
>
9499
<StyledGreenSlash>
95100
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
96-
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /{" "}
101+
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
102+
/{" "}
97103
</StyledGreenSlash>
98104
</StyledTopSlash>
99105
<StyledBottomSlash
@@ -103,7 +109,8 @@ const Home: FC<React.PropsWithChildren<unknown>> = () => {
103109
>
104110
<StyledBlueSlash>
105111
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
106-
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /{" "}
112+
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
113+
/{" "}
107114
</StyledBlueSlash>
108115
</StyledBottomSlash>
109116
</StyleHomeContainer>

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

-103
This file was deleted.

0 commit comments

Comments
 (0)