diff --git a/Sources/allin/allin.xcodeproj/project.pbxproj b/Sources/allin/allin.xcodeproj/project.pbxproj index 01f97b7..d88e295 100644 --- a/Sources/allin/allin.xcodeproj/project.pbxproj +++ b/Sources/allin/allin.xcodeproj/project.pbxproj @@ -16,6 +16,8 @@ D98C4D7F2AB9D019007A6B4D /* AllInUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D98C4D7E2AB9D019007A6B4D /* AllInUITests.swift */; }; D98C4D812AB9D019007A6B4D /* AllInUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D98C4D802AB9D019007A6B4D /* AllInUITestsLaunchTests.swift */; }; D98C4D8E2AB9D440007A6B4D /* TopBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D98C4D8D2AB9D440007A6B4D /* TopBarView.swift */; }; + EC46D7DD2ABCCC270030AC04 /* MenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC46D7DC2ABCCC270030AC04 /* MenuView.swift */; }; + EC46D7DF2ABCE0A20030AC04 /* ParameterMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC46D7DE2ABCE0A20030AC04 /* ParameterMenuView.swift */; }; EC87FCD62ABBA24000363986 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC87FCD52ABBA24000363986 /* Extensions.swift */; }; EC87FCD92ABBA60900363986 /* Colors.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC87FCD82ABBA60900363986 /* Colors.swift */; }; EC87FCDB2ABBA6AC00363986 /* TrendingBetCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC87FCDA2ABBA6AC00363986 /* TrendingBetCard.swift */; }; @@ -51,6 +53,8 @@ D98C4D7E2AB9D019007A6B4D /* AllInUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllInUITests.swift; sourceTree = ""; }; D98C4D802AB9D019007A6B4D /* AllInUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllInUITestsLaunchTests.swift; sourceTree = ""; }; D98C4D8D2AB9D440007A6B4D /* TopBarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TopBarView.swift; sourceTree = ""; }; + EC46D7DC2ABCCC270030AC04 /* MenuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = MenuView.swift; path = allin/Views/MenuView.swift; sourceTree = SOURCE_ROOT; }; + EC46D7DE2ABCE0A20030AC04 /* ParameterMenuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ParameterMenuView.swift; path = allin/Views/ParameterMenuView.swift; sourceTree = SOURCE_ROOT; }; EC87FCD52ABBA24000363986 /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Extensions.swift; path = allin/Extensions/Extensions.swift; sourceTree = SOURCE_ROOT; }; EC87FCD82ABBA60900363986 /* Colors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Colors.swift; path = allin/Ressources/Colors.swift; sourceTree = SOURCE_ROOT; }; EC87FCDA2ABBA6AC00363986 /* TrendingBetCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = TrendingBetCard.swift; path = allin/Views/TrendingBetCard.swift; sourceTree = SOURCE_ROOT; }; @@ -87,6 +91,8 @@ D98C4D8D2AB9D440007A6B4D /* TopBarView.swift */, D92EC57B2ABADA2800CCD30E /* CoinCounterView.swift */, EC87FCDA2ABBA6AC00363986 /* TrendingBetCard.swift */, + EC46D7DC2ABCCC270030AC04 /* MenuView.swift */, + EC46D7DE2ABCE0A20030AC04 /* ParameterMenuView.swift */, ); path = Views; sourceTree = ""; @@ -297,10 +303,12 @@ buildActionMask = 2147483647; files = ( EC87FCD62ABBA24000363986 /* Extensions.swift in Sources */, + EC46D7DD2ABCCC270030AC04 /* MenuView.swift in Sources */, EC87FCD92ABBA60900363986 /* Colors.swift in Sources */, D98C4D662AB9D017007A6B4D /* ContentView.swift in Sources */, D92EC57C2ABADA2800CCD30E /* CoinCounterView.swift in Sources */, D98C4D8E2AB9D440007A6B4D /* TopBarView.swift in Sources */, + EC46D7DF2ABCE0A20030AC04 /* ParameterMenuView.swift in Sources */, D98C4D642AB9D017007A6B4D /* AllInApp.swift in Sources */, EC87FCDB2ABBA6AC00363986 /* TrendingBetCard.swift in Sources */, ); diff --git a/Sources/allin/allin/Assets.xcassets/DarkLight.colorset/Contents.json b/Sources/allin/allin/Assets.xcassets/DarkLight.colorset/Contents.json new file mode 100644 index 0000000..09c53f9 --- /dev/null +++ b/Sources/allin/allin/Assets.xcassets/DarkLight.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x39", + "green" : "0x39", + "red" : "0x39" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x39", + "green" : "0x39", + "red" : "0x39" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Sources/allin/allin/Assets.xcassets/Eyes.imageset/Contents.json b/Sources/allin/allin/Assets.xcassets/Eyes.imageset/Contents.json new file mode 100644 index 0000000..31c8e24 --- /dev/null +++ b/Sources/allin/allin/Assets.xcassets/Eyes.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "Eyes.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Sources/allin/allin/Assets.xcassets/Eyes.imageset/Eyes.png b/Sources/allin/allin/Assets.xcassets/Eyes.imageset/Eyes.png new file mode 100644 index 0000000..8f18c08 Binary files /dev/null and b/Sources/allin/allin/Assets.xcassets/Eyes.imageset/Eyes.png differ diff --git a/Sources/allin/allin/Assets.xcassets/Friends.imageset/Contents.json b/Sources/allin/allin/Assets.xcassets/Friends.imageset/Contents.json new file mode 100644 index 0000000..81ecc77 --- /dev/null +++ b/Sources/allin/allin/Assets.xcassets/Friends.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "Woman And Man Holding Hands.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Sources/allin/allin/Assets.xcassets/Friends.imageset/Woman And Man Holding Hands.png b/Sources/allin/allin/Assets.xcassets/Friends.imageset/Woman And Man Holding Hands.png new file mode 100644 index 0000000..4717cce Binary files /dev/null and b/Sources/allin/allin/Assets.xcassets/Friends.imageset/Woman And Man Holding Hands.png differ diff --git a/Sources/allin/allin/Assets.xcassets/GearIcon.imageset/Contents.json b/Sources/allin/allin/Assets.xcassets/GearIcon.imageset/Contents.json new file mode 100644 index 0000000..e6a5918 --- /dev/null +++ b/Sources/allin/allin/Assets.xcassets/GearIcon.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "gear-solid 2.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Sources/allin/allin/Assets.xcassets/GearIcon.imageset/gear-solid 2.png b/Sources/allin/allin/Assets.xcassets/GearIcon.imageset/gear-solid 2.png new file mode 100644 index 0000000..546618c Binary files /dev/null and b/Sources/allin/allin/Assets.xcassets/GearIcon.imageset/gear-solid 2.png differ diff --git a/Sources/allin/allin/Assets.xcassets/Money.imageset/Contents.json b/Sources/allin/allin/Assets.xcassets/Money.imageset/Contents.json new file mode 100644 index 0000000..5a12c85 --- /dev/null +++ b/Sources/allin/allin/Assets.xcassets/Money.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "Money With Wings.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Sources/allin/allin/Assets.xcassets/Money.imageset/Money With Wings.png b/Sources/allin/allin/Assets.xcassets/Money.imageset/Money With Wings.png new file mode 100644 index 0000000..211c0b7 Binary files /dev/null and b/Sources/allin/allin/Assets.xcassets/Money.imageset/Money With Wings.png differ diff --git a/Sources/allin/allin/Assets.xcassets/VideoGame.imageset/Contents.json b/Sources/allin/allin/Assets.xcassets/VideoGame.imageset/Contents.json new file mode 100644 index 0000000..ae39c35 --- /dev/null +++ b/Sources/allin/allin/Assets.xcassets/VideoGame.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "Video Game.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Sources/allin/allin/Assets.xcassets/VideoGame.imageset/Video Game.png b/Sources/allin/allin/Assets.xcassets/VideoGame.imageset/Video Game.png new file mode 100644 index 0000000..dfa5d64 Binary files /dev/null and b/Sources/allin/allin/Assets.xcassets/VideoGame.imageset/Video Game.png differ diff --git a/Sources/allin/allin/ContentView.swift b/Sources/allin/allin/ContentView.swift index 298dbcb..85134d1 100644 --- a/Sources/allin/allin/ContentView.swift +++ b/Sources/allin/allin/ContentView.swift @@ -8,13 +8,33 @@ import SwiftUI struct ContentView: View { + + @State var showMenu = false + var body: some View { - VStack(alignment: .center) { - TopBarView() - TrendingBetCard()} - .edgesIgnoringSafeArea(.top) - .frame(alignment: .top) + let drag = DragGesture() + .onEnded { + if $0.translation.width < -100 { + withAnimation{ + self.showMenu = false + } + } + } + + GeometryReader { geometry in + ZStack(alignment: .leading) { + Home(showMenu: self.$showMenu) + .frame(width: geometry.size.width, height: geometry.size.height) + .offset(x: self.showMenu ? geometry.size.width/1.3:0) + if self.showMenu { + MenuView() + .frame(width: geometry.size.width*0.8) + .transition(.move(edge: .leading)) + } + } + .gesture(drag) + } } } @@ -23,3 +43,16 @@ struct ContentView_Previews: PreviewProvider { ContentView() } } + +struct Home: View { + + @Binding var showMenu: Bool + + var body: some View { + VStack(alignment: .center) { + TopBarView(showMenu: self.$showMenu) + TrendingBetCard()} + .edgesIgnoringSafeArea(.top) + } + +} diff --git a/Sources/allin/allin/Ressources/Colors.swift b/Sources/allin/allin/Ressources/Colors.swift index d0130c0..28a9236 100644 --- a/Sources/allin/allin/Ressources/Colors.swift +++ b/Sources/allin/allin/Ressources/Colors.swift @@ -12,4 +12,6 @@ struct AllinColor { static let darkGray = Color("DarkGray") static let darkerGray = Color("DarkerGray") static let pinkAccentText = Color("PinkAccentText") + static let darkLight = Color("DarkLight") + } diff --git a/Sources/allin/allin/Views/MenuView.swift b/Sources/allin/allin/Views/MenuView.swift new file mode 100644 index 0000000..9fbe7aa --- /dev/null +++ b/Sources/allin/allin/Views/MenuView.swift @@ -0,0 +1,37 @@ +// +// MenuView.swift +// AllIn +// +// Created by étudiant on 21/09/2023. +// + +import SwiftUI + +struct MenuView: View { + + var body: some View { + VStack(alignment: .leading) { + + ParameterMenuView(icon: "VideoGame", title: "CREER UN BET") + .padding(.top, 100) + + ParameterMenuView(icon: "Eyes", title: "HISTORIQUE DES BETS") + .padding(.top, 30) + + ParameterMenuView(icon: "Friends", title: "AMIS") + .padding(.top, 30) + + ParameterMenuView(icon: "Money", title: "BET EN COURS") + .padding(.top, 30) + Spacer() + Image("GearIcon") + .resizable() + .frame(width: 30, height: 30) + .padding([.leading,.bottom], 20) + } + .frame(maxWidth: .infinity,alignment: .leading) + .background(AllinColor.darkerGray) + .edgesIgnoringSafeArea(.all) + + } +} diff --git a/Sources/allin/allin/Views/ParameterMenuView.swift b/Sources/allin/allin/Views/ParameterMenuView.swift new file mode 100644 index 0000000..96e5866 --- /dev/null +++ b/Sources/allin/allin/Views/ParameterMenuView.swift @@ -0,0 +1,26 @@ +// +// ParameterMenuView.swift +// AllIn +// +// Created by étudiant on 21/09/2023. +// + +import SwiftUI + +struct ParameterMenuView: View { + + var icon: String + var title: String + + var body: some View { + HStack { + Image(icon) + Text(title) + .foregroundColor(.white) + .font(.headline) + Spacer() + } + .background(AllinColor.darkLight) + .cornerRadius(12) + } +} diff --git a/Sources/allin/allin/Views/TopBarView.swift b/Sources/allin/allin/Views/TopBarView.swift index 2c22980..4dfb29e 100644 --- a/Sources/allin/allin/Views/TopBarView.swift +++ b/Sources/allin/allin/Views/TopBarView.swift @@ -8,6 +8,9 @@ import SwiftUI struct TopBarView: View { + + @Binding var showMenu: Bool + var body: some View { let TopBarColorPink = Color(red: 249/255, green: 81/255, blue: 168/255) let TopBarColorBlue = Color(red: 25/255, green: 159/255, blue: 238/255) @@ -15,14 +18,14 @@ struct TopBarView: View { GeometryReader { geometry in ZStack() { HStack(){ - Image("menu") - .resizable() - .frame(width: 26,height: 15) - .padding(.leading, 30) + Button(action: {withAnimation{ self.showMenu = !self.showMenu }}) { + Image("menu") + .resizable() + .frame(width: 26,height: 15) + .padding(.leading, 30) + } Spacer() - CoinCounterView() - } .frame(width: geometry.size.width,alignment: .trailing) Image("Icon") @@ -33,7 +36,7 @@ struct TopBarView: View { } .frame(width: geometry.size.width, height: 120, alignment: .bottom) .background(LinearGradient(gradient: - Gradient(colors:[TopBarColorPink,TopBarColorPurple,TopBarColorBlue]), + Gradient(colors:[TopBarColorPink,TopBarColorPurple,TopBarColorBlue]), startPoint: .bottomLeading, endPoint: .topTrailing)) } }