Skip to content

Commit ef1fed7

Browse files
committed
[design] #167 링크 미리보기 shadow 수정 및 햅틱 피드백 수정
1 parent f2f1552 commit ef1fed7

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

Projects/DSKit/Sources/Components/PokitLinkPreview.swift

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import SwiftUI
99

10+
import Util
1011
import NukeUI
1112

1213
public struct PokitLinkPreview: View {
@@ -33,7 +34,6 @@ public struct PokitLinkPreview: View {
3334
}
3435
}
3536

36-
3737
private var buttonLabel: some View {
3838
HStack(spacing: 16) {
3939
Group {
@@ -54,18 +54,13 @@ public struct PokitLinkPreview: View {
5454
.background {
5555
RoundedRectangle(cornerRadius: 12, style: .continuous)
5656
.fill(.pokit(.bg(.base)))
57+
.shadow(color: .black.opacity(0.06), radius: 3, x: 2, y: 2)
5758
}
5859
.overlay {
5960
RoundedRectangle(cornerRadius: 12, style: .continuous)
6061
.stroke(.pokit(.border(.tertiary)), lineWidth: 1)
6162
}
62-
.shadow(color: .black.opacity(0.06), radius: 3, x: 2, y: 2)
63-
.onAppear {
64-
withAnimation {
65-
UINotificationFeedbackGenerator()
66-
.notificationOccurred(.success)
67-
}
68-
}
63+
.onChange(of: imageURL, perform: onChangeImageURL)
6964
}
7065

7166
@MainActor
@@ -134,6 +129,14 @@ public struct PokitLinkPreview: View {
134129
else { return }
135130
openURL(url)
136131
}
132+
133+
private func onChangeImageURL(_ imageURL: String?) {
134+
guard imageURL != nil else { return }
135+
let isError = title == Constants.제목을_입력해주세요_문구
136+
print("\(#function): \(isError), \(title)")
137+
UINotificationFeedbackGenerator()
138+
.notificationOccurred(isError ? .error : .success)
139+
}
137140
}
138141

139142
#Preview {

Projects/Feature/FeatureContentSetting/Sources/ContentSetting/ContentSettingFeature.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ private extension ContentSettingFeature {
255255
let contentTitle = state.title.isEmpty
256256
? Constants.제목을_입력해주세요_문구
257257
: state.title
258-
state.linkTitle = title ?? contentTitle
259258
state.linkImageURL = imageURL ?? Constants.기본_썸네일_주소.absoluteString
259+
state.linkTitle = title ?? contentTitle
260260
if let title, state.domain.title.isEmpty {
261261
state.domain.title = title
262262
}

0 commit comments

Comments
 (0)