Skip to content

Commit a834328

Browse files
authored
Merge pull request #372 from boostcampwm-2024/fix/trending-post
🐛 fix: 트랜딩 포스트가 없을 때 EmptyPost 컴포넌트가 나오지 않던 버그 수정 & 스켈레톤 UI가 나오지 않던 버그 수정
2 parents e101014 + fc5e55b commit a834328

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

client/src/components/common/Card/PostCardSkeleton.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Skeleton } from "@/components/ui/skeleton";
22

33
const PostCardSkeleton = () => {
44
return (
5-
<div className="h-[240px] bg-white rounded-lg p-4 space-y-3 shadow-sm">
5+
<div className="h-[240px] bg-white rounded-lg p-4 space-y-3">
66
<Skeleton className="w-full h-40 rounded-lg" />
77
<div className="space-y-2">
88
<Skeleton className="h-4 w-3/4" />
@@ -12,9 +12,9 @@ const PostCardSkeleton = () => {
1212
);
1313
};
1414

15-
const PostGridSkeleton = ({ count = 8 }) => {
15+
const PostGridSkeleton = ({ count = 4 }) => {
1616
return (
17-
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
17+
<div className="grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-4 gap-6 w-full">
1818
{Array.from({ length: count }).map((_, index) => (
1919
<PostCardSkeleton key={index} />
2020
))}

client/src/components/sections/AnimatedPostGrid.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface AnimatedPostGridProps {
1111
posts: Post[];
1212
}
1313

14-
const AnimatedPostGrid = ({ posts }: AnimatedPostGridProps) => {
14+
const AnimatedPostGrid = ({ posts = [] }: AnimatedPostGridProps) => {
1515
const { hasPosition } = usePositionTracking(posts);
1616
if (posts.length === 0) {
1717
return <EmptyPost />;

client/src/components/sections/TrendingSection.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export default function TrendingSection() {
1212
const { posts, isLoading } = useTrendingPosts();
1313
const isMobile = useMediaStore((state) => state.isMobile);
1414
const sectionStyle = isMobile ? undefined : { boxShadow: "0 0 15px rgba(0, 0, 0, 0.1)" };
15+
1516
return (
1617
<section className="flex flex-col md:p-4 min-h-[300px]">
1718
<SectionHeader
@@ -22,7 +23,7 @@ export default function TrendingSection() {
2223
/>
2324

2425
<div className="flex flex-1 md:mt-4 md:p-6 bg-white rounded-2xl transition-all duration-300" style={sectionStyle}>
25-
{isLoading || !posts.length ? <PostGridSkeleton count={4} /> : <AnimatedPostGrid posts={posts} />}
26+
{isLoading ? <PostGridSkeleton count={4} /> : <AnimatedPostGrid posts={posts} />}
2627
</div>
2728
</section>
2829
);

0 commit comments

Comments
 (0)