Changed searh bar
This commit is contained in:
parent
ac28d21f9e
commit
2b506ce538
@ -0,0 +1,38 @@
|
||||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0xF6",
|
||||
"green" : "0xF0",
|
||||
"red" : "0xF1"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0xFF",
|
||||
"green" : "0xFF",
|
||||
"red" : "0xFF"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
@ -8,7 +8,7 @@
|
||||
import SwiftUI
|
||||
|
||||
struct ContentView: View {
|
||||
@State private var selectedTab: TabModel = .schedule
|
||||
@State private var selectedTab: TabBarModel = .schedule
|
||||
var body: some View {
|
||||
ZStack {
|
||||
switch selectedTab {
|
||||
@ -21,7 +21,7 @@ struct ContentView: View {
|
||||
}
|
||||
TabBarView(selectedTab: $selectedTab)
|
||||
}
|
||||
.background(.secondary.opacity(0.15))
|
||||
.background(Color("background"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ struct ScheduleView: View {
|
||||
SearchBarView(text: $searchText)
|
||||
HeaderView()
|
||||
ScrollView(.vertical, showsIndicators: false) {
|
||||
VStack {
|
||||
VStack (spacing: 12) {
|
||||
ForEach(vm.weekSchedule, id: \.week) { element in
|
||||
let selectedDayIndex = vm.selectedIndex
|
||||
if selectedDayIndex < 8 {
|
||||
@ -49,7 +49,7 @@ struct ScheduleView: View {
|
||||
.padding(.bottom, 4)
|
||||
.foregroundColor(checkEnglish == "пр.Ино" || firstThreeCharacters == "лек" ? Color.blue : Color.green)
|
||||
Text(lesson)
|
||||
.font(.system(size: 16, weight: .medium))
|
||||
.font(.system(size: 16, weight: .regular))
|
||||
.padding(.trailing, 8)
|
||||
.frame(maxWidth: 280, alignment: .leading) // Выравнивание текста по левому краю
|
||||
.padding(.top, 4)
|
||||
|
@ -6,35 +6,45 @@ struct SearchBarView: View {
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
HStack {
|
||||
HStack (spacing: 0) {
|
||||
Image(systemName: "magnifyingglass")
|
||||
.foregroundColor(Color.gray)
|
||||
.padding(.leading, 10)
|
||||
.padding(.leading, 12)
|
||||
.padding(.trailing, 7)
|
||||
TextField("Поиск группы", text: $text)
|
||||
.disableAutocorrection(true)
|
||||
.frame(width: 270, height: 45)
|
||||
.overlay(
|
||||
Group {
|
||||
if isEditing {
|
||||
Button {
|
||||
self.text = ""
|
||||
self.isEditing = false
|
||||
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
|
||||
} label: {
|
||||
Image(systemName: "xmark.circle.fill")
|
||||
.padding(.trailing, 20)
|
||||
.offset(x: 10)
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
}
|
||||
}, alignment: .trailing
|
||||
)
|
||||
.frame(width: .infinity, height: 40)
|
||||
.onTapGesture {
|
||||
self.isEditing = true
|
||||
}
|
||||
.onSubmit {
|
||||
self.isEditing = false
|
||||
}
|
||||
if isEditing {
|
||||
Button {
|
||||
self.text = ""
|
||||
self.isEditing = false
|
||||
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
|
||||
} label: {
|
||||
Image(systemName: "xmark.circle.fill")
|
||||
.padding(.trailing, 20)
|
||||
.offset(x: 10)
|
||||
.foregroundColor(.gray)
|
||||
.background(
|
||||
Rectangle()
|
||||
.frame(width: 40, height: 40)
|
||||
.foregroundColor(.white)
|
||||
.cornerRadius(15)
|
||||
)
|
||||
}
|
||||
.background(Color.white)
|
||||
}
|
||||
else {
|
||||
Rectangle()
|
||||
.frame(width: 40, height: 40)
|
||||
.foregroundColor(.white)
|
||||
.cornerRadius(15)
|
||||
}
|
||||
}
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 10)
|
||||
@ -46,18 +56,20 @@ struct SearchBarView: View {
|
||||
} label: {
|
||||
ZStack {
|
||||
Rectangle()
|
||||
.frame(width: 40, height: 40)
|
||||
.frame(width: 36, height: 36)
|
||||
.foregroundStyle(Color("blueColor"))
|
||||
.cornerRadius(10)
|
||||
.cornerRadius(15)
|
||||
Image(systemName: "plus")
|
||||
.resizable()
|
||||
.foregroundStyle(.white)
|
||||
.scaledToFit()
|
||||
.frame(width: 16)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(width: .infinity)
|
||||
.padding(.horizontal)
|
||||
.padding(.vertical, 5)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
enum TabModel: String, CaseIterable {
|
||||
enum TabBarModel: String, CaseIterable {
|
||||
case schedule = "house"
|
||||
case tasks = "books.vertical"
|
||||
case settings = "gear"
|
@ -2,26 +2,25 @@
|
||||
// CustomTabBarView.swift
|
||||
// Schedule ICTIS
|
||||
//
|
||||
// Created by G412 on 13.11.2024.
|
||||
// Created by Egor Mironov on 13.11.2024.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct TabBarView: View {
|
||||
var isActiveForeground: Color = .white
|
||||
var isActiveBackground: Color = Color("blueColor")
|
||||
@Binding var selectedTab: TabModel
|
||||
@Binding var selectedTab: TabBarModel
|
||||
// @NameSpace private var animation
|
||||
var body: some View {
|
||||
VStack {
|
||||
Spacer()
|
||||
HStack(spacing: 0) {
|
||||
HStack(spacing: 15) {
|
||||
content
|
||||
}
|
||||
.animation(.smooth(duration: 0.3, extraBounce: 0), value: selectedTab)
|
||||
.padding(6)
|
||||
.background(.white)
|
||||
.mask(RoundedRectangle(cornerRadius: 24, style: .continuous))
|
||||
.shadow(color: .black.opacity(0.2), radius: 8, x: 4, y: 4)
|
||||
|
||||
// .background(
|
||||
// background
|
||||
@ -30,27 +29,27 @@ struct TabBarView: View {
|
||||
// in: .capsule
|
||||
// )
|
||||
}
|
||||
.ignoresSafeArea(.keyboard, edges: .bottom)
|
||||
.ignoresSafeArea(.keyboard, edges: .bottom) // Фиксаци таб-бара, при появлении клавиатуры
|
||||
}
|
||||
|
||||
var content: some View {
|
||||
ForEach(TabModel.allCases, id: \.rawValue) { tab in
|
||||
ForEach(TabBarModel.allCases, id: \.rawValue) { tab in
|
||||
Button {
|
||||
selectedTab = tab
|
||||
} label: {
|
||||
VStack {
|
||||
VStack (alignment: .center) {
|
||||
Image(systemName: tab.rawValue)
|
||||
.font(.title)
|
||||
.frame(width: 70, height: 30)
|
||||
.font(.title3)
|
||||
}
|
||||
.foregroundStyle(selectedTab == tab ? isActiveForeground : Color("blueColor"))
|
||||
.frame(width: 70, height: 28)
|
||||
.foregroundStyle(selectedTab == tab ? Color.white : Color("blueColor"))
|
||||
.padding(.vertical, 7)
|
||||
.padding(.leading, 13)
|
||||
.padding(.trailing, 13)
|
||||
.background {
|
||||
if selectedTab == tab {
|
||||
Capsule()
|
||||
.fill(isActiveBackground)
|
||||
.fill(Color("blueColor"))
|
||||
// .matchedGeometryEffect(id: "ACTIVETAB", in: animation)
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user