diff --git a/src/app/blog/[blogId]/components/Albums/Slider.tsx b/src/app/blog/[blogId]/components/Albums/Slider.tsx index 6554186..b3d8957 100644 --- a/src/app/blog/[blogId]/components/Albums/Slider.tsx +++ b/src/app/blog/[blogId]/components/Albums/Slider.tsx @@ -5,8 +5,15 @@ import Image from 'next/image'; import { Button } from '@/components/Common'; import { generateId } from '@/utils'; import { useSlider } from './useSlider'; +import { useBlogPageContext } from '../BlogFetcher/BlogContext'; + +export default function Slider() { + const { postItems } = useBlogPageContext(); + + const photos = postItems.flatMap(({ photoUrl }) => + photoUrl ? photoUrl.filter(Boolean) : [], + ); -export default function Slider({ photos }: { photos: string[] }) { const { currentIndex, nextSlide, prevSlide } = useSlider(photos.length); const photoCount = photos.length; const slideWidth = 100 / photoCount; @@ -30,11 +37,13 @@ export default function Slider({ photos }: { photos: string[] }) { src={photo} layout="fill" objectFit="cover" + className="rounded-10" /> ))} + {photoCount > 5 && (
+
- {postItems.map(({ preview, title }) => ( - + {postItems.map((postItem) => ( + ))}
diff --git a/src/app/blog/[blogId]/page.tsx b/src/app/blog/[blogId]/page.tsx index 614010e..bf90bf8 100644 --- a/src/app/blog/[blogId]/page.tsx +++ b/src/app/blog/[blogId]/page.tsx @@ -30,6 +30,7 @@ export default function Page() { +
@@ -40,6 +41,7 @@ export default function Page() { )} +