From 77a50a7dd232fecf391c845f65d2e23d7db78d21 Mon Sep 17 00:00:00 2001 From: Aakiyaru Date: Wed, 28 May 2025 15:52:10 +0700 Subject: [PATCH] fwe --- .../UIKitComponents/Select/SelectView.swift | 78 +++++++++++-------- 1 file changed, 45 insertions(+), 33 deletions(-) diff --git a/Sources/UIKitComponents/Select/SelectView.swift b/Sources/UIKitComponents/Select/SelectView.swift index ce80d56..800397f 100644 --- a/Sources/UIKitComponents/Select/SelectView.swift +++ b/Sources/UIKitComponents/Select/SelectView.swift @@ -12,47 +12,59 @@ public struct SelectView: View { @State var title: String @Binding var text: String let variants: [String] + let titleOne: String - public init(title: String, text: Binding, variants: [String]) { + public init(titleOne: String = "",title: String, text: Binding, variants: [String]) { self.title = title self._text = text self.variants = variants + self.titleOne = titleOne } public var body: some View { - ZStack { - Menu(content: { - ForEach(variants, id: \.self) { variant in - Button(variant) { - title = variant - text = variant - } - } - - }, label: { - Text("") - .frame(maxWidth: .infinity) - .frame(height: 48) - .cornerRadius(10) - .background( - RoundedRectangle(cornerRadius: 10) - .foregroundStyle(Color("hex#F5F5F9", bundle: .module)) - .overlay(content: { - RoundedRectangle(cornerRadius: 10) - .stroke(lineWidth: 1) - .foregroundStyle(Color("hex#EBEBEB", bundle: .module)) - }) - ) - }) - HStack { - Text(title) - .robotoFlex(size: 16) - .foregroundStyle(variants.contains(title) ? Color.black : (Color("hex#939396", bundle: .module))) - .tracking(0.32) + VStack(alignment: .leading, spacing: 0) { + if !titleOne.isEmpty { + Text(titleOne) + .robotoFlex(size: 14) + .foregroundStyle(Color("hex#7E7E9A", bundle: .module)) + .tracking(0) .lineSpacing(20) - Spacer() - Image("down", bundle: .module) - }.padding(.horizontal, 14) + .padding(.bottom, 4) + } + ZStack { + Menu(content: { + ForEach(variants, id: \.self) { variant in + Button(variant) { + title = variant + text = variant + } + } + + }, label: { + Text("") + .frame(maxWidth: .infinity) + .frame(height: 48) + .cornerRadius(10) + .background( + RoundedRectangle(cornerRadius: 10) + .foregroundStyle(Color("hex#F5F5F9", bundle: .module)) + .overlay(content: { + RoundedRectangle(cornerRadius: 10) + .stroke(lineWidth: 1) + .foregroundStyle(Color("hex#EBEBEB", bundle: .module)) + }) + ) + }) + HStack { + Text(title) + .robotoFlex(size: 16) + .foregroundStyle(variants.contains(title) ? Color.black : (Color("hex#939396", bundle: .module))) + .tracking(0.32) + .lineSpacing(20) + Spacer() + Image("down", bundle: .module) + }.padding(.horizontal, 14) + } } } }