Skip to content

Commit df2cc97

Browse files
committed
fix: hydration
1 parent b8c126c commit df2cc97

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

components/recruit/RecruitField/index.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ReactElement, useState } from 'react';
1+
import { ReactElement, useEffect, useState } from 'react';
22
import { RECRUITING_STATUS, RecruitStatus } from '../../../constants/status';
33
import { RECRUIT_FIELD_NAMES, RECRUIT_TITLE } from 'database/recruit';
44
import SectionTitle from 'components/common/SectionTitle';
@@ -11,9 +11,16 @@ import { useScrollAnimation } from 'hooks/useScrollAnimation';
1111

1212
function RecruitField(): ReactElement {
1313
const [flippedIndex, setFlippedIndex] = useState<number | null>(null);
14+
const [status, setStatus] = useState<RecruitStatus>(RecruitStatus.PRE);
1415
const { ref, controls, containerVariants, itemVariants } =
1516
useScrollAnimation();
1617

18+
useEffect(() => {
19+
setStatus(RECRUITING_STATUS());
20+
const timer = setInterval(() => setStatus(RECRUITING_STATUS()), 1000);
21+
return () => clearInterval(timer);
22+
}, []);
23+
1724
return (
1825
<SectionLayout
1926
ref={ref}
@@ -31,7 +38,7 @@ function RecruitField(): ReactElement {
3138
key={field.name}
3239
variants={itemVariants}
3340
onClick={() => {
34-
if (RECRUITING_STATUS() === RecruitStatus.ACTIVE && field.url) {
41+
if (status === RecruitStatus.ACTIVE && field.url) {
3542
window.open(field.url, '_blank');
3643
}
3744
}}
@@ -45,7 +52,7 @@ function RecruitField(): ReactElement {
4552
isFlipped={flippedIndex === index}
4653
onHoverStart={() => setFlippedIndex(index)}
4754
onHoverEnd={() => setFlippedIndex(null)}
48-
recruitingStatus={RECRUITING_STATUS()}
55+
recruitingStatus={status}
4956
/>
5057
</motion.li>
5158
))}

components/recruit/RecuitCard/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function RecruitCard({
7979

8080
export default RecruitCard;
8181

82-
const CardContainer = styled(motion.li)`
82+
const CardContainer = styled(motion.div)`
8383
perspective: 1000px;
8484
width: 274px;
8585
height: 290px;

0 commit comments

Comments
 (0)