feat(home): 사업자 정보 섹션을 연결한다

This commit is contained in:
Yu Sung
2026-06-30 02:17:54 +09:00
parent 339ca78793
commit 56e0c3dc27
5 changed files with 103 additions and 20 deletions

View File

@@ -1507,47 +1507,29 @@ enum I18n {
pick(
ko: """
- 회사명 : 주식회사 소다라이브
- 대표자 : 이재형
- 주소 : 경기도 성남시 분당구 황새울로335번길 10, 5층 563A호
- 사업자등록번호 : 870-81-03220
- 통신판매업신고 : 제2024-성남분당B-1012호
- 고객센터 : 02.2055.1477 (이용시간 10:00~19:00)
- 대표 이메일 : sodalive.official@gmail.com
""",
en: """
- Company: SodaLive Co., Ltd.
- CEO: Jaehyung Lee
- Address: 5F 563A, 10, Hwangsaeul-ro335beon-gil, Bundang-gu, Seongnam-si, Gyeonggi-do
- Business Registration No.: 870-81-03220
- Mail-order business report No.: 2024-SeongnamBundangB-1012
- Customer center: +82-2-2055-1477 (Hours 10:00~19:00)
- Email: sodalive.official@gmail.com
""",
ja: """
- 会社名株式会社SodaLive
- 代表者:イ・ジェヒョン
- 住所:京畿道 城南市 盆唐区 黄새울路335番ギル10、5階563A号
- 事業者登録番号870-81-03220
- 通信販売業届出第2024-城南盆唐B-1012号
- カスタマーセンター02.2055.1477(利用時間 10:00~19:00
- 代表メールsodalive.official@gmail.com
"""
)

View File

@@ -0,0 +1,76 @@
import SwiftUI
struct MainHomeBusinessInfoSection: View {
var body: some View {
BusinessInfoExpandableTextView(
text: I18n.Settings.companyInfo,
lineLimit: 3,
moreTitle: I18n.HomeRecommendation.more,
collapseTitle: I18n.HomeRecommendation.collapse,
font: .body5,
foregroundColor: Color.gray500
)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.horizontal, SodaSpacing.s14)
}
}
private struct BusinessInfoExpandableTextView: View {
let text: String
let lineLimit: Int
let moreTitle: String
let collapseTitle: String
let font: SodaTypography
let foregroundColor: Color
@State private var isExpanded = false
@State private var fullTextHeight: CGFloat = 0
@State private var limitedTextHeight: CGFloat = 0
var body: some View {
VStack(alignment: .leading, spacing: SodaSpacing.s8) {
Text(text)
.appFont(font)
.foregroundColor(foregroundColor)
.lineLimit(isExpanded ? nil : lineLimit)
.background(measuringText(lineLimit: nil, height: $fullTextHeight))
.background(measuringText(lineLimit: lineLimit, height: $limitedTextHeight))
if fullTextHeight > limitedTextHeight + 1 {
Button {
isExpanded.toggle()
} label: {
Text(isExpanded ? collapseTitle : moreTitle)
.appFont(.body5)
.foregroundColor(.white)
}
.buttonStyle(.plain)
}
}
}
private func measuringText(lineLimit: Int?, height: Binding<CGFloat>) -> some View {
Text(text)
.appFont(font)
.lineLimit(lineLimit)
.fixedSize(horizontal: false, vertical: true)
.hidden()
.background(
GeometryReader { proxy in
Color.clear
.onAppear { height.wrappedValue = proxy.size.height }
.onChange(of: proxy.size.height) { newHeight in height.wrappedValue = newHeight }
.onChange(of: text) { _ in height.wrappedValue = proxy.size.height }
}
)
}
}
struct MainHomeBusinessInfoSection_Previews: PreviewProvider {
static var previews: some View {
MainHomeBusinessInfoSection()
.padding(.vertical, SodaSpacing.s20)
.background(Color.black)
.previewLayout(.sizeThatFits)
}
}

View File

@@ -87,6 +87,8 @@ struct MainHomeRecommendationView: View {
viewModel.openCommunityPostPurchase(postId: item.postId, price: item.price)
}
)
MainHomeBusinessInfoSection()
}
.padding(.vertical, SodaSpacing.s20)
}