Lots of changes
This commit is contained in:
46
Schedule ICTIS/Main/Views/Fields/CommentFieldView.swift
Normal file
46
Schedule ICTIS/Main/Views/Fields/CommentFieldView.swift
Normal file
@ -0,0 +1,46 @@
|
||||
//
|
||||
// CommentView.swift
|
||||
// Schedule ICTIS
|
||||
//
|
||||
// Created by G412 on 17.12.2024.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct CommentFieldView: View {
|
||||
@Binding var textForComment: String
|
||||
@FocusState private var isFocused: Bool
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
TextField("Комментарий", text: $textForComment)
|
||||
.submitLabel(.done)
|
||||
.multilineTextAlignment(.leading)
|
||||
.focused($isFocused)
|
||||
.padding(.top, 6)
|
||||
.padding(.bottom, 6)
|
||||
|
||||
if isFocused {
|
||||
Button {
|
||||
textForComment = ""
|
||||
self.isFocused = false
|
||||
} label: {
|
||||
Image(systemName: "xmark.circle.fill")
|
||||
.padding(.trailing, 20)
|
||||
.offset(x: 10)
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(minHeight: 40)
|
||||
.padding(.horizontal)
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 10)
|
||||
.fill(.white)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
SheetCreateClassView(isShowingSheet: .constant(true))
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
//
|
||||
// Field.swift
|
||||
// Schedule ICTIS
|
||||
//
|
||||
// Created by G412 on 16.12.2024.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ProfessorAuditoryClassFieldView: View {
|
||||
@Binding var text: String
|
||||
var nameOfImage: String
|
||||
var labelForField: String
|
||||
@FocusState private var isFocused: 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)
|
||||
.submitLabel(.done)
|
||||
.focused($isFocused)
|
||||
if isFocused {
|
||||
Button {
|
||||
self.text = ""
|
||||
self.isFocused = false
|
||||
} label: {
|
||||
Image(systemName: "xmark.circle.fill")
|
||||
.padding(.trailing, 20)
|
||||
.offset(x: 10)
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(height: 40)
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 10)
|
||||
.fill(.white)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
ContentView()
|
||||
}
|
59
Schedule ICTIS/Main/Views/Fields/StartEndTimeFieldView.swift
Normal file
59
Schedule ICTIS/Main/Views/Fields/StartEndTimeFieldView.swift
Normal file
@ -0,0 +1,59 @@
|
||||
//
|
||||
// StartEndTimeView.swift
|
||||
// Schedule ICTIS
|
||||
//
|
||||
// Created by Mironov Egor on 17.12.2024.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct StartEndTimeFieldView: View {
|
||||
@Binding var selectedTime: Date
|
||||
var imageName: String
|
||||
var text: String
|
||||
@State private var isTimeSelected: Bool = false
|
||||
var body: some View {
|
||||
HStack {
|
||||
Image(systemName: imageName)
|
||||
.foregroundColor(Color("grayForFields"))
|
||||
.padding(.leading, 12)
|
||||
|
||||
if !isTimeSelected {
|
||||
Text(text)
|
||||
.font(.system(size: 17, weight: .regular))
|
||||
.foregroundColor(.gray.opacity(0.5))
|
||||
}
|
||||
|
||||
if isTimeSelected {
|
||||
Text("\(selectedTime, formatter: timeFormatter)")
|
||||
.foregroundColor(.black)
|
||||
.font(.system(size: 17, weight: .medium))
|
||||
.padding(.trailing, 10)
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
.frame(width: (UIScreen.main.bounds.width / 2) - 22, height: 40)
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 10)
|
||||
.fill(.white)
|
||||
)
|
||||
.overlay {
|
||||
DatePicker("", selection: $selectedTime, in: Date()..., displayedComponents: .hourAndMinute)
|
||||
.padding(.trailing, 35)
|
||||
.blendMode(.destinationOver)
|
||||
.onChange(of: selectedTime) { newValue, oldValue in
|
||||
isTimeSelected = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var timeFormatter: DateFormatter {
|
||||
let formatter = DateFormatter()
|
||||
formatter.dateFormat = "HH:mm"
|
||||
return formatter
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
StartEndTimeFieldView(selectedTime: .constant(Date()), imageName: "clock", text: "Начало")
|
||||
}
|
Reference in New Issue
Block a user