Skip to content

Commit

Permalink
[fix] #156 CautionType ์ ์šฉ
Browse files Browse the repository at this point in the history
  • Loading branch information
stealmh committed Nov 24, 2024
1 parent 07a383b commit 3b56c30
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 65 deletions.
31 changes: 12 additions & 19 deletions Projects/DSKit/Sources/Components/PokitCaution.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,14 @@ public enum CautionType {
}

public struct PokitCaution: View {
private let image: PokitImage.Character
private let titleKey: String
private let message: String
private let type: CautionType
private let action: (() -> Void)?

public init(
image: PokitImage.Character,
titleKey: String,
message: String,
type: CautionType,
action: (() -> Void)? = nil
) {
self.image = image
self.titleKey = titleKey
self.message = message
self.type = type
self.action = action
}

Expand All @@ -94,27 +88,28 @@ public struct PokitCaution: View {
Spacer()

VStack(spacing: 0) {
Image(.character(image))
Image(.character(type.image))
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 180, height: 180)
.padding(.bottom, 16)

Text(titleKey)
Text(type.title)
.pokitFont(.title2)
.foregroundStyle(.pokit(.text(.secondary)))
.padding(.bottom, 8)

Text(message)
Text(type.message)
.pokitFont(.b2(.m))
.foregroundStyle(.pokit(.text(.secondary)))
.padding(.bottom, 16)

if let action {
if let action,
let actionTitle = type.actionTitle {
PokitTextButton(
"๋‹ค์‹œ์‹œ๋„",
state: .default(.secondary),
size: .small,
actionTitle,
state: .stroke(.secondary),
size: .medium,
shape: .rectangle,
action: action
)
Expand All @@ -128,9 +123,7 @@ public struct PokitCaution: View {

#Preview {
PokitCaution(
image: .empty,
titleKey: "์ €์žฅ๋œ ํฌํ‚ท์ด ์—†์–ด์š”!",
message: "ํฌํ‚ท์„ ์ƒ์„ฑํ•ด ๋งํฌ๋ฅผ ์ €์žฅํ•ด๋ณด์„ธ์š”",
type: .๋ฏธ๋ถ„๋ฅ˜_๋งํฌ์—†์Œ,
action: {}
)
}
6 changes: 1 addition & 5 deletions Projects/DSKit/Sources/Components/PokitList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ public struct PokitList<Item: PokitSelectItem>: View {
public var body: some View {
if list.isEmpty {
VStack {
PokitCaution(
image: .empty,
titleKey: "์ €์žฅ๋œ ํฌํ‚ท์ด ์—†์–ด์š”!",
message: "ํฌํ‚ท์„ ์ƒ์„ฑํ•ด ๋งํฌ๋ฅผ ์ €์žฅํ•ด๋ณด์„ธ์š”"
)
PokitCaution(type: .์นดํ…Œ๊ณ ๋ฆฌ์—†์Œ)

Spacer()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,7 @@ private extension CategoryDetailView {
if !store.isLoading {
if store.contents.isEmpty {
VStack {
PokitCaution(
image: .empty,
titleKey: "์ €์žฅ๋œ ๋งํฌ๊ฐ€ ์—†์–ด์š”!",
message: "๋‹ค์–‘ํ•œ ๋งํฌ๋ฅผ ํ•œ ๊ณณ์— ์ €์žฅํ•ด๋ณด์„ธ์š”"
)
PokitCaution(type: .๋งํฌ์—†์Œ)
.padding(.top, 20)

Spacer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,7 @@ private extension CategorySharingView {
if !store.isLoading {
if store.contents.isEmpty {
VStack {
PokitCaution(
image: .empty,
titleKey: "์ €์žฅ๋œ ๋งํฌ๊ฐ€ ์—†์–ด์š”!",
message: "๋‹ค์–‘ํ•œ ๋งํฌ๋ฅผ ํ•œ ๊ณณ์— ์ €์žฅํ•ด๋ณด์„ธ์š”"
)
PokitCaution(type: .๋งํฌ์—†์Œ)
.padding(.top, 20)

Spacer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,7 @@ private extension ContentListView {
Group {
if !store.isLoading {
if store.contents.isEmpty {
PokitCaution(
image: .empty,
titleKey: "์ฆ๊ฒจ์ฐพ๊ธฐ ๋งํฌ๊ฐ€ ์—†์–ด์š”!",
message: "๋งํฌ๋ฅผ ์ฆ๊ฒจ์ฐพ๊ธฐ๋กœ ๊ด€๋ฆฌํ•ด๋ณด์„ธ์š”"
)
PokitCaution(type: .์ฆ๊ฒจ์ฐพ๊ธฐ_๋งํฌ์—†์Œ)
.padding(.top, 100)

Spacer()
Expand Down
8 changes: 2 additions & 6 deletions Projects/Feature/FeaturePokit/Sources/PokitRootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ private extension PokitRootView {
if categories.isEmpty {
VStack {
PokitCaution(
image: .empty,
titleKey: "์ €์žฅ๋œ ํฌํ‚ท์ด ์—†์–ด์š”!",
message: "ํฌํ‚ท์„ ์ƒ์„ฑํ•ด ๋งํฌ๋ฅผ ์ €์žฅํ•ด๋ณด์„ธ์š”"
type: .์นดํ…Œ๊ณ ๋ฆฌ์—†์Œ,
)
.padding(.top, 36)

Expand Down Expand Up @@ -171,9 +169,7 @@ private extension PokitRootView {
if store.contents.isEmpty {
VStack {
PokitCaution(
image: .empty,
titleKey: "์ €์žฅ๋œ ๋งํฌ๊ฐ€ ์—†์–ด์š”!",
message: "๋‹ค์–‘ํ•œ ๋งํฌ๋ฅผ ํ•œ ๊ณณ์— ์ €์žฅํ•ด๋ณด์„ธ์š”"
type: .๋ฏธ๋ถ„๋ฅ˜_๋งํฌ์—†์Œ,
)
.padding(.top, 36)

Expand Down
18 changes: 3 additions & 15 deletions Projects/Feature/FeatureRemind/Sources/Remind/RemindView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,7 @@ extension RemindView {
unreadContents.isEmpty &&
favoriteContents.isEmpty {
VStack {
PokitCaution(
image: .sad,
titleKey: "๋งํฌ๊ฐ€ ๋ถ€์กฑํ•ด์š”!",
message: "๋งํฌ๋ฅผ 5๊ฐœ ์ด์ƒ ์ €์žฅํ•˜๊ณ  ์ถ”์ฒœ์„ ๋ฐ›์•„๋ณด์„ธ์š”"
)
PokitCaution(type: .๋งํฌ๋ถ€์กฑ)
.padding(.top, 100)

Spacer()
Expand Down Expand Up @@ -111,11 +107,7 @@ extension RemindView {
.padding(.horizontal, 20)

if recommendedContents.isEmpty {
PokitCaution(
image: .sad,
titleKey: "๋งํฌ๊ฐ€ ๋ถ€์กฑํ•ด์š”!",
message: "๋งํฌ๋ฅผ 5๊ฐœ ์ด์ƒ ์ €์žฅํ•˜๊ณ  ์ถ”์ฒœ์„ ๋ฐ›์•„๋ณด์„ธ์š”"
)
PokitCaution(type: .๋งํฌ๋ถ€์กฑ)
.padding(.top, 24)
.padding(.bottom, 32)
} else {
Expand Down Expand Up @@ -293,11 +285,7 @@ extension RemindView {
.padding(.bottom, 16)

if favoriteContents.isEmpty {
PokitCaution(
image: .empty,
titleKey: "์ฆ๊ฒจ์ฐพ๊ธฐ ๋งํฌ๊ฐ€ ์—†์–ด์š”!",
message: "๋งํฌ๋ฅผ ์ฆ๊ฒจ์ฐพ๊ธฐ๋กœ ๊ด€๋ฆฌํ•ด๋ณด์„ธ์š”"
)
PokitCaution(type: .์ฆ๊ฒจ์ฐพ๊ธฐ_๋งํฌ์—†์Œ)
.padding(.top, 16)
} else {
ForEach(favoriteContents, id: \.id) { content in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ public extension PokitAlertBoxView {
if let alertContents = store.alertContents {
if alertContents.isEmpty {
VStack {
PokitCaution(
image: .pooki,
titleKey: "์•Œ๋ฆผ์ด ์—†์–ด์š”",
message: "๋ฆฌ๋งˆ์ธ๋“œ ์•Œ๋ฆผ์„ ์„ค์ •ํ•˜์„ธ์š”"
)
PokitCaution(type: .์•Œ๋ฆผ์—†์Œ)
.padding(.top, 84)
Spacer()
}
Expand Down

0 comments on commit 3b56c30

Please sign in to comment.