Lots of changes
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct CommentView: View {
|
||||
struct CommentFieldView: View {
|
||||
@Binding var textForComment: String
|
||||
@FocusState private var isFocused: Bool
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct FieldView: View {
|
||||
struct ProfessorAuditoryClassFieldView: View {
|
||||
@Binding var text: String
|
||||
var nameOfImage: String
|
||||
var labelForField: String
|
@ -7,7 +7,7 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct StartEndTimeView: View {
|
||||
struct StartEndTimeFieldView: View {
|
||||
@Binding var selectedTime: Date
|
||||
var imageName: String
|
||||
var text: String
|
||||
@ -55,5 +55,5 @@ struct StartEndTimeView: View {
|
||||
}
|
||||
|
||||
#Preview {
|
||||
StartEndTimeView(selectedTime: .constant(Date()), imageName: "clock", text: "Начало")
|
||||
StartEndTimeFieldView(selectedTime: .constant(Date()), imageName: "clock", text: "Начало")
|
||||
}
|
@ -15,7 +15,7 @@ struct LoadingView: View {
|
||||
.ignoresSafeArea()
|
||||
ProgressView()
|
||||
.progressViewStyle(CircularProgressViewStyle(tint: .secondary))
|
||||
.scaleEffect(1.2)
|
||||
.scaleEffect(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ struct SheetChangeClassView: View {
|
||||
NavigationView {
|
||||
VStack {
|
||||
Spacer()
|
||||
Text("Создание новой пары")
|
||||
Text("Редактирвоание пары")
|
||||
Spacer()
|
||||
}
|
||||
.toolbar {
|
@ -24,11 +24,11 @@ struct SheetCreateClassView: View {
|
||||
NavigationView {
|
||||
ScrollView(.vertical, showsIndicators: false) {
|
||||
VStack {
|
||||
FieldView(text: $textForNameOfClass, nameOfImage: "book", labelForField: "Предмет")
|
||||
ProfessorAuditoryClassFieldView(text: $textForNameOfClass, nameOfImage: "book", labelForField: "Предмет")
|
||||
.padding(.bottom, 10)
|
||||
FieldView(text: $textForNameOfAuditory, nameOfImage: "mappin.and.ellipse", labelForField: "Корпус-аудитория")
|
||||
ProfessorAuditoryClassFieldView(text: $textForNameOfAuditory, nameOfImage: "mappin.and.ellipse", labelForField: "Корпус-аудитория")
|
||||
.padding(.bottom, 10)
|
||||
FieldView(text: $textForNameOfProfessor, nameOfImage: "book", labelForField: "Преподаватель")
|
||||
ProfessorAuditoryClassFieldView(text: $textForNameOfProfessor, nameOfImage: "book", labelForField: "Преподаватель")
|
||||
.padding(.bottom, 10)
|
||||
HStack {
|
||||
Image(systemName: "calendar")
|
||||
@ -55,9 +55,9 @@ struct SheetCreateClassView: View {
|
||||
}
|
||||
.padding(.bottom, 10)
|
||||
HStack {
|
||||
StartEndTimeView(selectedTime: $selectedStartTime, imageName: "clock", text: "Начало")
|
||||
StartEndTimeFieldView(selectedTime: $selectedStartTime, imageName: "clock", text: "Начало")
|
||||
Spacer()
|
||||
StartEndTimeView(selectedTime: $selectedEndTime, imageName: "clock.badge.xmark", text: "Конец")
|
||||
StartEndTimeFieldView(selectedTime: $selectedEndTime, imageName: "clock.badge.xmark", text: "Конец")
|
||||
}
|
||||
.frame(height: 40)
|
||||
.padding(.bottom, 10)
|
||||
@ -88,7 +88,7 @@ struct SheetCreateClassView: View {
|
||||
)
|
||||
.padding(.bottom, 10)
|
||||
|
||||
CommentView(textForComment: $textForComment)
|
||||
CommentFieldView(textForComment: $textForComment)
|
||||
Spacer()
|
||||
}
|
||||
.padding(.horizontal)
|
@ -1,58 +0,0 @@
|
||||
//
|
||||
// TextFiledView.swift
|
||||
// Schedule ICTIS
|
||||
//
|
||||
// Created by G412 on 17.12.2024.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct TextFiledView: View {
|
||||
@State private var isEditing: Bool = false
|
||||
@State private var text: String = ""
|
||||
@State private var nameOfImage: String = "calendar"
|
||||
@State private var labelForField: String = "Преподаватель"
|
||||
|
||||
@FocusState private var isTextFieldFocused: Bool
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 0) {
|
||||
Image(systemName: nameOfImage)
|
||||
.foregroundColor(Color.gray)
|
||||
.padding(.leading, 12)
|
||||
.padding(.trailing, 7)
|
||||
|
||||
TextField(labelForField, text: $text)
|
||||
.font(.system(size: 18, weight: .regular))
|
||||
.disableAutocorrection(true)
|
||||
.focused($isTextFieldFocused)
|
||||
.onChange(of: isTextFieldFocused) { newValue, oldValue in
|
||||
isEditing = newValue
|
||||
}
|
||||
.submitLabel(.done)
|
||||
|
||||
if isTextFieldFocused {
|
||||
Button {
|
||||
self.text = ""
|
||||
self.isEditing = false
|
||||
isTextFieldFocused = false
|
||||
} label: {
|
||||
Image(systemName: "xmark.circle.fill")
|
||||
.padding()
|
||||
.padding(.trailing, 20)
|
||||
.offset(x: 10)
|
||||
.foregroundColor(.red)
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(height: 40)
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 10)
|
||||
.fill(.white)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
TextFiledView()
|
||||
}
|
Reference in New Issue
Block a user