Skip to content

Commit d87a5dc

Browse files
authored
Refacotr: 가정예배 리스트 앨범형식으로 변경 (#251)
* refacotr: 가정예배 앨범리스트로 변경 * chore: 가정예배는 8개씩 가져오도록 설정
1 parent d67ffe3 commit d87a5dc

File tree

3 files changed

+30
-25
lines changed

3 files changed

+30
-25
lines changed

apps/client/src/components/discipleship/homeworship/list.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const HomeworshipListSection = ({ data }: IHomeworshipListSectionProps) => {
1111
const { push } = useRouter();
1212

1313
return (
14-
<div className="flex flex-col gap-3 px-4 sm:gap-4 sm:px-6 md:px-12 lg:px-16">
14+
<div className="grid grid-cols-2 gap-2 px-3 sm:gap-4 sm:px-6 md:grid-cols-3 md:px-12 lg:grid-cols-4 lg:px-16">
1515
{data?.homeworships.map((worship: IHomeWorship) => {
1616
return (
1717
<HomeworshipListItem

apps/client/src/components/discipleship/homeworship/listItem.tsx

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { format } from "date-fns";
2-
import { it } from "node:test";
32
import { IHomeWorship } from "type";
43

54
interface IHomeworshipListItemProps {
@@ -8,37 +7,42 @@ interface IHomeworshipListItemProps {
87
}
98
const HomeworshipListItem = ({ item, onClick }: IHomeworshipListItemProps) => {
109
const imageUrl = item.imageUrls?.[0] ?? "/images/home/homeworship.png";
11-
const date = item.date ? format(new Date(item.date), "yyyy.MM.dd") : format(new Date(item.createdAt), "yyyy.MM.dd");
10+
const date = item.date
11+
? format(new Date(item.date), "yyyy.MM.dd")
12+
: format(new Date(item.createdAt), "yyyy.MM.dd");
1213

1314
return (
1415
<div
1516
onClick={onClick}
16-
className="flex cursor-pointer flex-col gap-3 rounded-lg border border-gray-200 bg-white p-3 shadow-sm transition-shadow hover:shadow-md sm:gap-4 sm:p-4"
17+
className="group cursor-pointer overflow-hidden rounded-xl border border-gray-100 bg-white shadow-sm transition-shadow hover:shadow-md"
1718
>
18-
{/* 날짜 및 작성자 */}
19-
<div className="flex items-center justify-between text-xs text-gray-500 sm:text-sm">
20-
<span>{date}</span>
21-
<span className="text-blue-900">{item.userName}</span>
22-
</div>
23-
24-
{/* 썸네일 및 제목 */}
25-
<div className="flex gap-3 sm:gap-4">
26-
{imageUrl && (
27-
<div className="h-16 w-16 flex-shrink-0 overflow-hidden rounded bg-gray-100 sm:h-20 sm:w-20 md:h-24 md:w-24">
28-
<img src={imageUrl} alt={item.title || "가정예배 이미지"} className="h-full w-full object-cover" />
19+
{/* 썸네일 */}
20+
<div className="relative aspect-square w-full overflow-hidden bg-gray-100">
21+
<img
22+
src={imageUrl}
23+
alt={item.title || "가정예배 이미지"}
24+
className="h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"
25+
/>
26+
{item.comments?.length > 0 && (
27+
<div className="absolute bottom-1.5 right-1.5 flex items-center gap-0.5 rounded-full bg-black/60 px-1.5 py-0.5 text-white sm:bottom-2 sm:right-2 sm:gap-1 sm:px-3 sm:py-1">
28+
<svg className="size-3.5 sm:size-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
29+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" />
30+
</svg>
31+
<span className="text-xs font-bold sm:text-sm">{item.comments.length}</span>
2932
</div>
3033
)}
31-
<div className="flex flex-1 flex-col justify-center">
32-
<h3 className="line-clamp-2 break-keep text-sm font-medium text-gray-800 sm:text-base md:text-lg">
33-
{item.title || "예배 갤러리_맞있는 가정예배 인증해주셔서 감사합니다"}
34-
</h3>
35-
</div>
3634
</div>
3735

38-
{/* 자세히 보기 버튼 */}
39-
<button className="w-full rounded border border-gray-300 bg-white py-2 text-xs font-medium text-gray-700 transition-colors hover:bg-[#2d4a6f] hover:text-white sm:py-2.5 sm:text-sm">
40-
자세히 보기
41-
</button>
36+
{/* 정보 */}
37+
<div className="p-2 sm:p-3">
38+
<h3 className="line-clamp-2 break-keep text-xs font-medium text-gray-800 sm:text-sm">
39+
{item.title || "가정예배 갤러리"}
40+
</h3>
41+
<div className="mt-1 flex items-center justify-between text-[10px] text-gray-400 sm:text-xs">
42+
<span className="text-blue-900">{item.userName}</span>
43+
<span>{date}</span>
44+
</div>
45+
</div>
4246
</div>
4347
);
4448
};

apps/client/src/query/homeWorship/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import homeWorshipKeys from "./keys";
1313
import usePagination from "@/hooks/usePagination";
1414

1515
const useGetHomeWorships = () => {
16-
const { page, size } = usePagination();
16+
const { page } = usePagination();
17+
const size = 8;
1718

1819
return useQuery({
1920
placeholderData: (previousData) => previousData,

0 commit comments

Comments
 (0)