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