-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
홈 및 블로그 코드 개선 완료
- Loading branch information
Showing
44 changed files
with
705 additions
and
444 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { StrictPropsWithChildren } from '@type/component'; | ||
|
||
interface EmptyBoxProps extends StrictPropsWithChildren {} | ||
|
||
const EmptyBox = ({ children }: EmptyBoxProps) => { | ||
return <p className="w-full text-center text-gray-500">{children}</p>; | ||
}; | ||
|
||
export default EmptyBox; |
33 changes: 0 additions & 33 deletions
33
apps/member/src/components/common/ImageBanner/ImageBanner.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import useModal from '@hooks/common/useModal'; | ||
import { calculateDDay, formattedDate } from '@utils/date'; | ||
import { cn } from '@utils/string'; | ||
import { useCallback } from 'react'; | ||
|
||
interface NoticeProps { | ||
title: string; | ||
content: string; | ||
date: string; | ||
showDDay?: boolean; | ||
className?: string; | ||
} | ||
|
||
const Notice = ({ | ||
title, | ||
content, | ||
date, | ||
showDDay = false, | ||
className, | ||
}: NoticeProps) => { | ||
const { openModal } = useModal(); | ||
|
||
const handleNoticeClick = useCallback(() => { | ||
openModal({ | ||
title: '📆 공지', | ||
content, | ||
}); | ||
}, [content, openModal]); | ||
|
||
let renderDDay: React.ReactNode | null = null; | ||
if (showDDay) { | ||
const dDay = calculateDDay(date); | ||
renderDDay = ( | ||
<div | ||
className={cn( | ||
'min-w-[4rem] rounded-full text-center text-sm text-white font-semibold bg-red-400', | ||
{ | ||
'bg-yellow-400': dDay >= 14, | ||
'bg-sky-400': dDay >= 30, | ||
}, | ||
)} | ||
> | ||
D-{dDay} | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<div | ||
className={cn( | ||
'w-full hover:bg-gray-100 rounded-lg transition-colors', | ||
className, | ||
)} | ||
> | ||
<button | ||
className="flex items-center justify-between w-full gap-2 outline-none cursor-pointer" | ||
onClick={handleNoticeClick} | ||
> | ||
<div className="flex items-center gap-2"> | ||
{showDDay && renderDDay} | ||
<p className="w-full truncate">{title}</p> | ||
</div> | ||
<p className="text-sm text-gray-500 whitespace-nowrap"> | ||
{formattedDate(date)} | ||
</p> | ||
</button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Notice; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { useCallback } from 'react'; | ||
import { useNavigate } from 'react-router-dom'; | ||
import { createImageUrl } from '@utils/api'; | ||
import { cn } from '@utils/string'; | ||
import Image from '../Image/Image'; | ||
|
||
interface PostCardProps { | ||
to: string; | ||
title: string; | ||
subTitle?: string; | ||
imageUrl?: string; | ||
} | ||
|
||
const PostCard = ({ to, title, subTitle, imageUrl }: PostCardProps) => { | ||
const navigate = useNavigate(); | ||
|
||
const handleClick = useCallback(() => navigate(to), [navigate, to]); | ||
|
||
return ( | ||
<div | ||
role="button" | ||
onClick={handleClick} | ||
className="flex flex-col items-center p-2 space-y-2 transition rounded-lg cursor-pointer hover:bg-gray-100" | ||
> | ||
<Image | ||
src={createImageUrl(imageUrl)} | ||
alt={title} | ||
width="w-48" | ||
height="h-48" | ||
className="object-cover border rounded-lg" | ||
/> | ||
<div className="w-48"> | ||
<p | ||
className={cn('break-keep', { | ||
'text-center': !subTitle, | ||
})} | ||
> | ||
{title} | ||
</p> | ||
{subTitle && ( | ||
<p className="text-sm truncate text-clab-main-light">{subTitle}</p> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default PostCard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
apps/member/src/components/common/Section/SectionSkeleton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Section from './Section'; | ||
|
||
const SectionSkeleton = () => { | ||
return ( | ||
<Section className="w-full h-96 animate-pulse"> | ||
<Section.Header title=""></Section.Header> | ||
</Section> | ||
); | ||
}; | ||
|
||
export default SectionSkeleton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { default as Section } from './Section'; | ||
export { default as SectionSkeleton } from './SectionSkeleton'; |
21 changes: 21 additions & 0 deletions
21
apps/member/src/components/common/TextBanner/TextBanner.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
interface TextBannerProps { | ||
label: string; | ||
description?: string; | ||
} | ||
|
||
const TextBanner = ({ label, description }: TextBannerProps) => { | ||
return ( | ||
<div className="py-4 text-xl font-semibold text-center"> | ||
<h3 className="inline-block font-bold text-transparent bg-gradient-to-r from-sky-600 via-indigo-500 to-purple-500 bg-clip-text"> | ||
{label} | ||
</h3> | ||
{description && ( | ||
<p className="flex justify-center gap-2 text-xs text-gray-500"> | ||
{description} | ||
</p> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default TextBanner; |
Oops, something went wrong.