Skip to content

Commit dc6a8d5

Browse files
committed
[feat] #183 즐겨찾기 화면 구성
1 parent 415b999 commit dc6a8d5

File tree

2 files changed

+69
-51
lines changed

2 files changed

+69
-51
lines changed

Projects/Feature/FeatureCategoryDetail/Sources/CategoryDetailFeature.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ public struct CategoryDetailFeature {
4040
var isFavoriteFiltered: Bool {
4141
get { domain.condition.isFavoriteFlitered }
4242
}
43+
var isFavoriteCategory: Bool {
44+
get { domain.category.isFavorite }
45+
}
4346

4447
var sortType: SortType = .최신순
4548
var categories: IdentifiedArrayOf<BaseCategoryItem>? {

Projects/Feature/FeatureCategoryDetail/Sources/CategoryDetailView.swift

Lines changed: 66 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,13 @@ private extension CategoryDetailView {
9696
action: { send(.dismiss) }
9797
)
9898
}
99-
PokitHeaderItems(placement: .trailing) {
100-
PokitToolbarButton(
101-
.icon(.kebab),
102-
action: { send(.카테고리_케밥_버튼_눌렀을때) }
103-
)
99+
if !store.isFavoriteCategory {
100+
PokitHeaderItems(placement: .trailing) {
101+
PokitToolbarButton(
102+
.icon(.kebab),
103+
action: { send(.카테고리_케밥_버튼_눌렀을때) }
104+
)
105+
}
104106
}
105107
}
106108
.padding(.top, 8)
@@ -137,69 +139,82 @@ private extension CategoryDetailView {
137139
.buttonStyle(.plain)
138140
}
139141
.padding(.bottom, 8)
140-
HStack(spacing: 3.5) {
141-
let iconColor: Color = .pokit(.icon(.secondary))
142-
let textColor: Color = .pokit(.text(.tertiary))
143-
144-
if store.category.openType == .비공개 {
142+
if !store.isFavoriteCategory {
143+
HStack(spacing: 3.5) {
144+
let iconColor: Color = .pokit(.icon(.secondary))
145+
let textColor: Color = .pokit(.text(.tertiary))
146+
147+
if store.category.openType == .비공개 {
148+
HStack(spacing: 2) {
149+
Image(.icon(.lock))
150+
.resizable()
151+
.frame(width: 16, height: 16)
152+
.foregroundStyle(iconColor)
153+
Text("비밀")
154+
.foregroundStyle(textColor)
155+
.pokitFont(.b2(.m))
156+
}
157+
}
145158
HStack(spacing: 2) {
146-
Image(.icon(.lock))
159+
Image(.icon(.link))
147160
.resizable()
148161
.frame(width: 16, height: 16)
149162
.foregroundStyle(iconColor)
150-
Text("비밀")
163+
Text("\(store.contents.count)")
151164
.foregroundStyle(textColor)
152165
.pokitFont(.b2(.m))
153166
}
154-
}
155-
HStack(spacing: 2) {
156-
Image(.icon(.link))
157-
.resizable()
158-
.frame(width: 16, height: 16)
159-
.foregroundStyle(iconColor)
160-
Text("\(store.contents.count)")
167+
Text("#\(store.category.keywordType.title)")
161168
.foregroundStyle(textColor)
162169
.pokitFont(.b2(.m))
170+
.padding(.leading, 4.5)
163171
}
164-
Text("#\(store.category.keywordType.title)")
165-
.foregroundStyle(textColor)
166-
.pokitFont(.b2(.m))
167-
.padding(.leading, 4.5)
172+
.padding(.bottom, 16)
173+
PokitIconLButton(
174+
"공유",
175+
.icon(.share),
176+
state: .filled(.primary),
177+
size: .medium,
178+
shape: .round,
179+
action: { send(.공유_버튼_눌렀을때) }
180+
)
168181
}
169-
.padding(.bottom, 16)
170-
PokitIconLButton(
171-
"공유",
172-
.icon(.share),
173-
state: .filled(.primary),
174-
size: .medium,
175-
shape: .round,
176-
action: { send(.공유_버튼_눌렀을때) }
177-
)
178182
}
179183
}
180184

181185
@ViewBuilder
182186
var filterHeader: some View {
187+
let isFavoriteCategory = store.isFavoriteCategory
183188
if !store.contents.isEmpty {
184-
HStack(spacing: 8) {
185-
PokitTextButton(
186-
"즐겨찾기",
187-
state: store.isFavoriteFiltered
188-
? .filled(.primary)
189-
: .default(.secondary),
190-
size: .small,
191-
shape: .round,
192-
action: { send(.분류_버튼_눌렀을때(.즐겨찾기)) }
193-
)
194-
PokitTextButton(
195-
"안읽음",
196-
state: store.isUnreadFiltered
197-
? .filled(.primary)
198-
: .default(.secondary),
199-
size: .small,
200-
shape: .round,
201-
action: { send(.분류_버튼_눌렀을때(.안읽음)) }
202-
)
189+
HStack(spacing: isFavoriteCategory ? 2 : 8) {
190+
if isFavoriteCategory {
191+
Image(.icon(.link))
192+
.resizable()
193+
.frame(width: 16, height: 16)
194+
.foregroundStyle(.pokit(.icon(.secondary)))
195+
Text("\(store.contents.count)")
196+
.foregroundStyle(.pokit(.text(.tertiary)))
197+
.pokitFont(.b2(.m))
198+
} else {
199+
PokitTextButton(
200+
"즐겨찾기",
201+
state: store.isFavoriteFiltered
202+
? .filled(.primary)
203+
: .default(.secondary),
204+
size: .small,
205+
shape: .round,
206+
action: { send(.분류_버튼_눌렀을때(.즐겨찾기)) }
207+
)
208+
PokitTextButton(
209+
"안읽음",
210+
state: store.isUnreadFiltered
211+
? .filled(.primary)
212+
: .default(.secondary),
213+
size: .small,
214+
shape: .round,
215+
action: { send(.분류_버튼_눌렀을때(.안읽음)) }
216+
)
217+
}
203218

204219
Spacer()
205220
PokitIconLTextLink(

0 commit comments

Comments
 (0)