From 53ea8288ff428f780e244642e720dd4bf04c6ca9 Mon Sep 17 00:00:00 2001 From: danilpapa Date: Sat, 23 May 2026 12:54:36 +0300 Subject: [PATCH 1/2] setup create wish place UI --- .../WishPlaces/CreateWishPlaceSheet.swift | 77 +++++++++++-------- 1 file changed, 43 insertions(+), 34 deletions(-) diff --git a/iosApp/iosApp/Modules/Profile/WishPlaces/CreateWishPlaceSheet.swift b/iosApp/iosApp/Modules/Profile/WishPlaces/CreateWishPlaceSheet.swift index a6bef61..32bee6d 100644 --- a/iosApp/iosApp/Modules/Profile/WishPlaces/CreateWishPlaceSheet.swift +++ b/iosApp/iosApp/Modules/Profile/WishPlaces/CreateWishPlaceSheet.swift @@ -8,43 +8,51 @@ import SwiftUI struct CreateWishPlaceSheet: View { - + @State private var title = "" @State private var description = "" @State private var location = "" @State private var link = "" - + let onDismiss: () -> Void let onCreate: (String, String?, String?, String?) -> Void - + var isCreateButtonEnabled: Bool { !title.trimmingCharacters(in: .whitespaces).isEmpty } - + var body: some View { NavigationStack { ScrollView { - VStack(spacing: 16) { + VStack(spacing: DesignTheme.Spacing.lg) { TextField("Title *", text: $title) - .textFieldStyle(.roundedBorder) - .padding(.horizontal) - + .placeholder(when: title.isEmpty) { + Text("Title *").foregroundColor(.gray) + } + .formTextField() + TextField("Location", text: $location) - .textFieldStyle(.roundedBorder) - .padding(.horizontal) - + .placeholder(when: location.isEmpty) { + Text("Location").foregroundColor(.gray) + } + .formTextField() + TextField("Description", text: $description, axis: .vertical) - .textFieldStyle(.roundedBorder) + .placeholder(when: description.isEmpty) { + Text("Description").foregroundColor(.gray) + } + .formTextField() .frame(minHeight: 80, maxHeight: 120) - .padding(.horizontal) - + TextField("Link", text: $link) - .textFieldStyle(.roundedBorder) - .padding(.horizontal) - + .placeholder(when: link.isEmpty) { + Text("Link").foregroundColor(.gray) + } + .formTextField() + Spacer() - .frame(height: 16) - + .frame(height: DesignTheme.Spacing.md) + Button(action: { onCreate( title, @@ -54,20 +62,18 @@ struct CreateWishPlaceSheet: View { ) }) { Text("Create") - .frame(maxWidth: .infinity) - .padding(.vertical, 12) - .background(isCreateButtonEnabled ? Color.blue : Color.gray) - .foregroundColor(.white) - .cornerRadius(8) + .font(DesignTheme.Typography.button) } - .disabled(!isCreateButtonEnabled) - .padding(.horizontal) - + .primaryButton(isEnabled: isCreateButtonEnabled) + .padding(.horizontal, DesignTheme.Spacing.lg) + Spacer() - .frame(height: 32) + .frame(height: DesignTheme.Spacing.xxxl) } - .padding(.vertical, 16) + .padding(.vertical, DesignTheme.Spacing.lg) + .padding(.horizontal, DesignTheme.Spacing.lg) } + .background(Color(UIColor.systemBackground)) .navigationTitle("Add Wish Place") .navigationBarTitleDisplayMode(.inline) .toolbar { @@ -75,15 +81,18 @@ struct CreateWishPlaceSheet: View { Button("Cancel") { onDismiss() } + .foregroundColor(DesignTheme.accentColor) } } } } } -#Preview { - CreateWishPlaceSheet( - onDismiss: {}, - onCreate: { _, _, _, _ in } - ) +extension View { + func placeholder(when shouldShow: Bool, alignment: Alignment = .leading, @ViewBuilder placeholder: () -> Content) -> some View { + ZStack(alignment: alignment) { + placeholder().opacity(shouldShow ? 1 : 0) + self + } + } } From aab37f0fc8fe6f6fe3903132d46d2813762814fd Mon Sep 17 00:00:00 2001 From: danilpapa Date: Sat, 23 May 2026 12:58:44 +0300 Subject: [PATCH 2/2] add UI on create wish place --- .../mobile/wishplaces/WishPlacesComponents.kt | 50 +++++++++---------- .../Profile/WishPlaces/WishPlacesView.swift | 1 + 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/composeApp/src/androidMain/kotlin/friends/mobile/wishplaces/WishPlacesComponents.kt b/composeApp/src/androidMain/kotlin/friends/mobile/wishplaces/WishPlacesComponents.kt index 567c489..3079488 100644 --- a/composeApp/src/androidMain/kotlin/friends/mobile/wishplaces/WishPlacesComponents.kt +++ b/composeApp/src/androidMain/kotlin/friends/mobile/wishplaces/WishPlacesComponents.kt @@ -33,7 +33,6 @@ import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.ModalBottomSheet -import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.SwipeToDismissBox import androidx.compose.material3.SwipeToDismissBoxValue import androidx.compose.material3.Text @@ -52,6 +51,8 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import friends.mobile.designkit.DesignTheme +import friends.mobile.designkit.FormTextField +import friends.mobile.designkit.PrimaryButton import friends.mobile.feature.wishplaces.domain.model.WishPlace @OptIn(ExperimentalMaterial3Api::class) @@ -183,47 +184,49 @@ fun CreateWishPlaceBottomSheet( onDismissRequest = onDismiss, sheetState = sheetState, dragHandle = { BottomSheetDefaults.DragHandle() }, + containerColor = Color.White, + scrimColor = Color.Black.copy(alpha = 0.3f) ) { Column( modifier = Modifier .fillMaxWidth() - .padding(16.dp) + .padding(DesignTheme.Spacing.lg) .navigationBarsPadding() .imePadding() .verticalScroll(rememberScrollState()), - verticalArrangement = Arrangement.spacedBy(12.dp) + verticalArrangement = Arrangement.spacedBy(DesignTheme.Spacing.md) ) { - Text("Add Wish Place", style = MaterialTheme.typography.headlineSmall) - - OutlinedTextField( + Text("Add Wish Place", style = DesignTheme.Typography.heading) + + FormTextField( value = title, onValueChange = { title = it }, - label = { Text("Title") }, + placeholder = "Title", modifier = Modifier.fillMaxWidth() ) - OutlinedTextField( + FormTextField( value = location, onValueChange = { location = it }, - label = { Text("Location") }, + placeholder = "Location", modifier = Modifier.fillMaxWidth() ) - OutlinedTextField( + FormTextField( value = description, onValueChange = { description = it }, - label = { Text("Description") }, - modifier = Modifier.fillMaxWidth(), - minLines = 3 + placeholder = "Description", + modifier = Modifier.fillMaxWidth() ) - OutlinedTextField( + FormTextField( value = link, onValueChange = { link = it }, - label = { Text("Link") }, + placeholder = "Link", modifier = Modifier.fillMaxWidth() ) - Spacer(modifier = Modifier.height(8.dp)) + Spacer(modifier = Modifier.height(DesignTheme.Spacing.md)) - Button( + PrimaryButton( + text = "Create", onClick = { onCreate( title, @@ -232,15 +235,10 @@ fun CreateWishPlaceBottomSheet( link.ifBlank { null } ) }, - modifier = Modifier - .fillMaxWidth() - .height(50.dp), - enabled = title.isNotBlank() - ) { - Text("Create") - } - - Spacer(modifier = Modifier.height(32.dp)) + isEnabled = title.isNotBlank() + ) + + Spacer(modifier = Modifier.height(DesignTheme.Spacing.xxxl)) } } } diff --git a/iosApp/iosApp/Modules/Profile/WishPlaces/WishPlacesView.swift b/iosApp/iosApp/Modules/Profile/WishPlaces/WishPlacesView.swift index ac0e7a6..59a7b78 100644 --- a/iosApp/iosApp/Modules/Profile/WishPlaces/WishPlacesView.swift +++ b/iosApp/iosApp/Modules/Profile/WishPlaces/WishPlacesView.swift @@ -115,6 +115,7 @@ struct WishPlacesView: View { ) } ) + .presentationDetents([.medium, .large]) } .sheet(item: $reducer.selectedPlace) { place in WishPlaceDetailSheet(place: place)