Skip to content

Commit 84f5360

Browse files
committed
✨[feat]: 일정표 목록 컴포넌트 추가 DDD-Community#30
1 parent 94b4017 commit 84f5360

File tree

11 files changed

+123
-0
lines changed

11 files changed

+123
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
//
2+
// ScheduleCell.swift
3+
// DesignSystem
4+
//
5+
// Created by eunpyo on 4/22/25.
6+
//
7+
8+
import SwiftUI
9+
10+
public struct ScheduleCell: View {
11+
private let month: Int
12+
private let day: Int
13+
private let title: String
14+
private let description: String
15+
private let style: ScheduleCellStyle
16+
17+
public init(
18+
month: Int,
19+
day: Int,
20+
title: String,
21+
description: String,
22+
style: ScheduleCellStyle
23+
) {
24+
self.month = month
25+
self.day = day
26+
self.title = title
27+
self.description = description
28+
self.style = style
29+
}
30+
31+
public var body: some View {
32+
HStack(alignment: .center, spacing: .zero) {
33+
VStack(alignment: .center, spacing: 4) {
34+
Text("\(month)")
35+
.pretendardFont(family: .Medium, size: 14)
36+
.foregroundStyle(.staticBlack)
37+
38+
Text("\(day)")
39+
.pretendardFont(family: .Medium, size: 20)
40+
.foregroundStyle(.staticBlack)
41+
}
42+
.frame(width: 54, height: 54)
43+
.background(.blue20)
44+
.opacity(style.monthDayOpacity)
45+
.clipShape(.rect(cornerRadius: 12))
46+
47+
VStack(alignment: .leading, spacing: .zero) {
48+
Text(title)
49+
.pretendardFont(family: .Bold, size: 18)
50+
.foregroundStyle(.backgroundInverse)
51+
52+
Text(description)
53+
.pretendardFont(family: .Regular, size: 14)
54+
.foregroundStyle(.textSecondary)
55+
}
56+
.padding(.leading, 12)
57+
.opacity(style.titleDescriptionOpacity)
58+
59+
Spacer()
60+
}
61+
.overlay {
62+
if let stampImage = style.stampImage {
63+
GeometryReader { proxy in
64+
let xPosition = proxy.size.width * 0.82205128
65+
let yPosition = proxy.size.height * 0.92953488
66+
67+
stampImage
68+
.resizable()
69+
.scaledToFit()
70+
.rotationEffect(.degrees(-15))
71+
.position(x: xPosition, y: yPosition)
72+
.frame(width: 120, height: 120)
73+
.opacity(0.8)
74+
}
75+
}
76+
}
77+
.padding(16)
78+
.background(style.backgroundColor)
79+
.clipShape(.rect(cornerRadius: 16))
80+
.overlay {
81+
if style.dashBorder {
82+
RoundedRectangle(cornerRadius: 16)
83+
.stroke(.gray60, style: StrokeStyle(lineWidth: 1, dash: [4, 4]))
84+
}
85+
}
86+
}
87+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//
2+
// ScheduleCellStyle.swift
3+
// DesignSystem
4+
//
5+
// Created by eunpyo on 4/22/25.
6+
//
7+
8+
import SwiftUI
9+
10+
public struct ScheduleCellStyle {
11+
public let backgroundColor: Color
12+
public let stampImage: Image?
13+
public let dashBorder: Bool
14+
public let monthDayOpacity: Double
15+
public let titleDescriptionOpacity: Double
16+
17+
public init(
18+
backgroundColor: Color,
19+
stampImage: Image?,
20+
dashBorder: Bool,
21+
monthDayOpacity: Double,
22+
titleDescriptionOpacity: Double
23+
) {
24+
self.backgroundColor = backgroundColor
25+
self.stampImage = stampImage
26+
self.dashBorder = dashBorder
27+
self.monthDayOpacity = monthDayOpacity
28+
self.titleDescriptionOpacity = titleDescriptionOpacity
29+
}
30+
}

0 commit comments

Comments
 (0)