Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor : RecruitButton 컴포넌트 스타일 및 남은 시간 표시 로직 변경 #78

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 26 additions & 12 deletions apps/web/src/components/common/AboutRecruit/RecruitButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import dayjs from 'dayjs';
import Link from 'next/link';
import React, { useEffect, useState } from 'react';
import { useEffect, useState } from 'react';

export default function RecruitButton() {
const [timeLeft, setTimeLeft] = useState<string>('');
Expand All @@ -27,11 +27,13 @@ export default function RecruitButton() {
const days = Math.floor(difference / (3600 * 24));
const hours = Math.floor((difference / 3600) % 24);
const minutes = Math.floor((difference / 60) % 60);
const seconds = difference % 60;
// const seconds = difference % 60;

return `4기 지원 마감까지 ${days}일 ${hours.toString().padStart(2, '0')}:${minutes
.toString()
.padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
if (days > 0 || hours >= 24) {
return '현재 메이커스 4기 모집 중 (~2/7 토요일 자정)';
}

return `지원 마감까지 ${hours.toString()}시간 ${minutes.toString().padStart(2, '0')}분 남았어요.`;
};

setTimeLeft(calculateTimeLeft());
Expand All @@ -44,12 +46,24 @@ export default function RecruitButton() {
}, []);

return (
<Link
href='/recruit/'
className='bg-dark1 mb-[3rem] mt-[4rem] rounded-[1.2rem] border border-solid border-[#808388] px-[4rem] py-[1.6rem]'
>
<p className='md:text-24-semibold text-18-semibold'>4기 합류하기 (~2/7)</p>
<p className='text-16-regular mt-[1.2rem] text-center'>{timeLeft}</p>
</Link>
<>
<Link
href='/recruit/'
className='mb-[0.5rem] mt-[4rem] rounded-[1.2rem] border border-solid border-[#808388] bg-white px-[2.6rem] py-[1.6rem]'
>
<p className='md:text-18-semibold text-18-semibold text-black100 flex items-center justify-center gap-[0.25rem]'>
4기 지원하기 <RightArrow />
</p>
</Link>
<p className='text-16-regular text-brand-orange mb-[4.2rem] mt-[1.2rem] text-center'>{timeLeft}</p>
</>
);

function RightArrow(props: React.SVGProps<SVGSVGElement>) {
return (
<svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg' {...props}>
<path d='M9 18L15 12L9 6' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' />
</svg>
);
}
}
Loading