diff --git a/Schedule ICTIS/Assets.xcassets/background.colorset/Contents.json b/Schedule ICTIS/Assets.xcassets/background.colorset/Contents.json new file mode 100644 index 0000000..5cdfbad --- /dev/null +++ b/Schedule ICTIS/Assets.xcassets/background.colorset/Contents.json @@ -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 + } +} diff --git a/Schedule ICTIS/ContentView.swift b/Schedule ICTIS/ContentView.swift index 35b11dd..1be01bf 100644 --- a/Schedule ICTIS/ContentView.swift +++ b/Schedule ICTIS/ContentView.swift @@ -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")) } } diff --git a/Schedule ICTIS/ScheduleView.swift b/Schedule ICTIS/ScheduleView.swift index aa8882b..ff4ceca 100644 --- a/Schedule ICTIS/ScheduleView.swift +++ b/Schedule ICTIS/ScheduleView.swift @@ -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) diff --git a/Schedule ICTIS/SearchBarView.swift b/Schedule ICTIS/SearchBarView.swift index 4f8da9a..92ce693 100644 --- a/Schedule ICTIS/SearchBarView.swift +++ b/Schedule ICTIS/SearchBarView.swift @@ -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) } } diff --git a/Schedule ICTIS/TabModel.swift b/Schedule ICTIS/TabBar/TabBarModel.swift similarity index 81% rename from Schedule ICTIS/TabModel.swift rename to Schedule ICTIS/TabBar/TabBarModel.swift index 463e59e..b0ce5a2 100644 --- a/Schedule ICTIS/TabModel.swift +++ b/Schedule ICTIS/TabBar/TabBarModel.swift @@ -7,7 +7,7 @@ import SwiftUI -enum TabModel: String, CaseIterable { +enum TabBarModel: String, CaseIterable { case schedule = "house" case tasks = "books.vertical" case settings = "gear" diff --git a/Schedule ICTIS/TabBarView.swift b/Schedule ICTIS/TabBar/TabBarView.swift similarity index 67% rename from Schedule ICTIS/TabBarView.swift rename to Schedule ICTIS/TabBar/TabBarView.swift index 5dd17f6..f583201 100644 --- a/Schedule ICTIS/TabBarView.swift +++ b/Schedule ICTIS/TabBar/TabBarView.swift @@ -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) } }