Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

검색 화면 네비게이션 백 스와이프 활성화 및 미비된 UI 수정 #125

Merged
merged 5 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct ProductDetailResponse: Decodable {

struct ProductDetailItemResponse: Decodable {
let name: String
let img: URL
let img: URL?
let price: Int
let store: ConvenienceStore
let tag: Promotion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
buildConfiguration = "Staging"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = "ko"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand All @@ -62,6 +63,10 @@
ReferencedContainer = "container:PyeonHaeng-iOS.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<LocationScenarioReference
identifier = "com.apple.dt.IDEFoundation.CurrentLocationScenarioIdentifier"
referenceType = "1">
</LocationScenarioReference>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
4 changes: 2 additions & 2 deletions PyeonHaeng-iOS/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"ko" : {
"stringUnit" : {
"state" : "translated",
"value" : "검색어의 단어수를 줄이거나,"
"value" : "검색어의 단어수를 줄이거나,"
}
}
}
Expand All @@ -111,7 +111,7 @@
"ko" : {
"stringUnit" : {
"state" : "translated",
"value" : "단어의 철자가 정확한지 확인해보세요."
"value" : "단어의 철자가 정확한지 확인해보세요."
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,13 @@ private struct ProductImageView: View {
.scaledToFit()
.frame(width: Metrics.originalImageSize, height: Metrics.originalImageSize)
.padding(.all, (Metrics.totalImageSize - Metrics.originalImageSize) * 0.5)
} else if phase.error != nil {
} else {
Image.textLogo
.resizable()
.scaledToFit()
.frame(width: Metrics.textLogoWidth, height: Metrics.textLogoHeight)
.padding(.horizontal, (Metrics.totalImageSize - Metrics.textLogoWidth) / 2)
.padding(.vertical, (Metrics.totalImageSize - Metrics.textLogoHeight) / 2)
} else {
ProgressView()
.frame(width: Metrics.totalImageSize, height: Metrics.totalImageSize)
}
}
.accessibilityHidden(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ private struct ImageView: View {
.resizable()
.scaledToFit()
} placeholder: {
// TODO: 편행 기본 이미지 추가
ProgressView()
Image.textLogo
.resizable()
.scaledToFit()
.padding(100)
}
.frame(maxWidth: .infinity, maxHeight: Metrics.imageHeight)
.padding(.top, Metrics.imagePaddingTop)
Expand Down Expand Up @@ -63,12 +65,21 @@ private struct DetailView: View {
}
Spacer()
HStack(spacing: Metrics.horizontalSpacing) {
PromotionTagView(promotionTag: promotionTag(for: product.promotion))
Text("개당")
.font(.c1)
Text("\(Int(product.price / 2).formatted())원")
.font(.h2)
.frame(maxHeight: 38.0)
Group {
PromotionTagView(promotionTag: promotionTag(for: product.promotion))
Text("개당")
.font(.c1)
}
.padding(.bottom, -12)
VStack(alignment: .trailing, spacing: .zero) {
Text("\(product.price.formatted())원")
.font(.x2)
.foregroundStyle(.gray100)
.strikethrough(color: .gray100)
.padding(.bottom, -4)
Text("\(Int(product.price / 2).formatted())원")
.font(.h2)
}
}
.frame(maxWidth: .infinity, alignment: .trailing)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private struct LineGraphPanelView: View {
Text(verbatim: "\(formatted(product.date))")
.font(.c4)
.foregroundStyle(.gray400)
Text("\((product.price / 2).formatted())원")
Text("\(product.price.formatted())원")
.font(.b1)
.foregroundStyle(.gray900)
Rectangle()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,22 @@ struct ProductInfoView<ViewModel>: View where ViewModel: ProductInfoViewModelRep
}

var body: some View {
VStack {
if viewModel.state.isLoading {
ProgressView()
.containerRelativeFrame(.vertical)
} else {
ProductInfoDetailView<ViewModel>()
ProductInfoLineGraphView<ViewModel>()
Spacer()
ScrollView {
VStack {
if viewModel.state.isLoading {
ProgressView()
.containerRelativeFrame(.vertical)
} else {
ProductInfoDetailView<ViewModel>()
ProductInfoLineGraphView<ViewModel>()
Spacer()
}
}
.padding(.horizontal, 20.0)
}
.environmentObject(viewModel)
.navigationTitle("제품 상세")
.navigationBarTitleDisplayMode(.inline)
.padding(.horizontal, 20.0)
.onAppear {
viewModel.trigger(.fetchProduct)
}
Expand Down
21 changes: 6 additions & 15 deletions PyeonHaeng-iOS/Sources/Scenes/ProductSearchScene/SearchView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,6 @@ struct SearchView<ViewModel>: View where ViewModel: SearchViewModelRepresentable
}

var body: some View {
HStack(spacing: 8) {
Button {
dismiss()
} label: {
Image.chevronLeftLarge
.resizable()
.scaledToFit()
.frame(width: 24)
}
SearchTextField<ViewModel>(text: $text)
.environmentObject(viewModel)
}
.padding(.horizontal, 20)
ScrollView {
if viewModel.state.isLoading {
ProgressView()
Expand Down Expand Up @@ -91,7 +78,11 @@ struct SearchView<ViewModel>: View where ViewModel: SearchViewModelRepresentable
}
}
}
.toolbar(.hidden, for: .automatic)
.toolbar {
ToolbarItem(placement: .principal) {
SearchTextField<ViewModel>(text: $text)
}
}
.scrollIndicators(.hidden)
.scrollDismissesKeyboard(.immediately)
.environmentObject(viewModel)
Expand Down Expand Up @@ -176,7 +167,7 @@ private enum Metrics {
static let textFieldVerticalPadding = 8.0
static let textFieldLeadingPadding = 12.0
static let textFieldTrailingPadding = 40.0
static let textFieldHeight = 32.0
static let textFieldHeight = 24.0
static let textFieldBorderWidth = 1.0
static let cornerRadius = 8.0

Expand Down