start working on trending card

Menu
lucas delanier 2 years ago
parent 92c80b9e24
commit ca0935e6e6

@ -16,6 +16,9 @@
D98C4D7F2AB9D019007A6B4D /* AllInUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D98C4D7E2AB9D019007A6B4D /* AllInUITests.swift */; }; D98C4D7F2AB9D019007A6B4D /* AllInUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D98C4D7E2AB9D019007A6B4D /* AllInUITests.swift */; };
D98C4D812AB9D019007A6B4D /* AllInUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D98C4D802AB9D019007A6B4D /* AllInUITestsLaunchTests.swift */; }; D98C4D812AB9D019007A6B4D /* AllInUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D98C4D802AB9D019007A6B4D /* AllInUITestsLaunchTests.swift */; };
D98C4D8E2AB9D440007A6B4D /* TopBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D98C4D8D2AB9D440007A6B4D /* TopBarView.swift */; }; D98C4D8E2AB9D440007A6B4D /* TopBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D98C4D8D2AB9D440007A6B4D /* TopBarView.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 */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */ /* Begin PBXContainerItemProxy section */
@ -48,6 +51,9 @@
D98C4D7E2AB9D019007A6B4D /* AllInUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllInUITests.swift; sourceTree = "<group>"; }; D98C4D7E2AB9D019007A6B4D /* AllInUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllInUITests.swift; sourceTree = "<group>"; };
D98C4D802AB9D019007A6B4D /* AllInUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllInUITestsLaunchTests.swift; sourceTree = "<group>"; }; D98C4D802AB9D019007A6B4D /* AllInUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllInUITestsLaunchTests.swift; sourceTree = "<group>"; };
D98C4D8D2AB9D440007A6B4D /* TopBarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TopBarView.swift; sourceTree = "<group>"; }; D98C4D8D2AB9D440007A6B4D /* TopBarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TopBarView.swift; sourceTree = "<group>"; };
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; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
@ -80,6 +86,7 @@
children = ( children = (
D98C4D8D2AB9D440007A6B4D /* TopBarView.swift */, D98C4D8D2AB9D440007A6B4D /* TopBarView.swift */,
D92EC57B2ABADA2800CCD30E /* CoinCounterView.swift */, D92EC57B2ABADA2800CCD30E /* CoinCounterView.swift */,
EC87FCDA2ABBA6AC00363986 /* TrendingBetCard.swift */,
); );
path = Views; path = Views;
sourceTree = "<group>"; sourceTree = "<group>";
@ -107,6 +114,7 @@
D98C4D622AB9D017007A6B4D /* AllIn */ = { D98C4D622AB9D017007A6B4D /* AllIn */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
EC87FCD72ABBA5F200363986 /* Ressources */,
ECF816C72ABB51E300DE30A4 /* Extensions */, ECF816C72ABB51E300DE30A4 /* Extensions */,
D92EC5782ABAC6B900CCD30E /* Views */, D92EC5782ABAC6B900CCD30E /* Views */,
D98C4D632AB9D017007A6B4D /* AllInApp.swift */, D98C4D632AB9D017007A6B4D /* AllInApp.swift */,
@ -142,9 +150,18 @@
path = AllInUITests; path = AllInUITests;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
EC87FCD72ABBA5F200363986 /* Ressources */ = {
isa = PBXGroup;
children = (
EC87FCD82ABBA60900363986 /* Colors.swift */,
);
path = Ressources;
sourceTree = "<group>";
};
ECF816C72ABB51E300DE30A4 /* Extensions */ = { ECF816C72ABB51E300DE30A4 /* Extensions */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
EC87FCD52ABBA24000363986 /* Extensions.swift */,
); );
path = Extensions; path = Extensions;
sourceTree = "<group>"; sourceTree = "<group>";
@ -279,10 +296,13 @@
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
EC87FCD62ABBA24000363986 /* Extensions.swift in Sources */,
EC87FCD92ABBA60900363986 /* Colors.swift in Sources */,
D98C4D662AB9D017007A6B4D /* ContentView.swift in Sources */, D98C4D662AB9D017007A6B4D /* ContentView.swift in Sources */,
D92EC57C2ABADA2800CCD30E /* CoinCounterView.swift in Sources */, D92EC57C2ABADA2800CCD30E /* CoinCounterView.swift in Sources */,
D98C4D8E2AB9D440007A6B4D /* TopBarView.swift in Sources */, D98C4D8E2AB9D440007A6B4D /* TopBarView.swift in Sources */,
D98C4D642AB9D017007A6B4D /* AllInApp.swift in Sources */, D98C4D642AB9D017007A6B4D /* AllInApp.swift in Sources */,
EC87FCDB2ABBA6AC00363986 /* TrendingBetCard.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x2A",
"green" : "0x2A",
"red" : "0x2A"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x2A",
"green" : "0x2A",
"red" : "0x2A"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x89",
"green" : "0x2A",
"red" : "0xFF"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x89",
"green" : "0x2A",
"red" : "0xFF"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

@ -0,0 +1,22 @@
{
"images" : [
{
"filename" : "Mask group.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Mask group-2.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 950 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 B

@ -9,10 +9,12 @@ import SwiftUI
struct ContentView: View { struct ContentView: View {
var body: some View { var body: some View {
VStack(alignment: .leading) { VStack(alignment: .center) {
TopBarView() TopBarView()
} TrendingBetCard()}
.edgesIgnoringSafeArea(.top) .edgesIgnoringSafeArea(.top)
.frame(alignment: .top)
} }
} }

@ -0,0 +1,35 @@
//
// Extensions.swift
// AllIn
//
// Created by étudiant on 20/09/2023.
//
import Foundation
import SwiftUI
// Extension for rounded Double to 0 decimals
extension Double {
func roundDouble() -> String {
return String(format: "%.0f", self)
}
}
// Extension for adding rounded corners to specific corners
extension View {
func cornerRadius(_ radius: CGFloat, corners: UIRectCorner) -> some View {
clipShape(RoundedCorner(radius: radius, corners: corners) )
}
}
// Custom RoundedCorner shape used for cornerRadius extension above
struct RoundedCorner: Shape {
var radius: CGFloat = .infinity
var corners: UIRectCorner = .allCorners
func path(in rect: CGRect) -> Path {
let path = UIBezierPath(roundedRect: rect, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
return Path(path.cgPath)
}
}

@ -0,0 +1,15 @@
//
// Colors.swift
// AllIn
//
// Created by étudiant on 21/09/2023.
//
import Foundation
import SwiftUI
struct AllinColor {
static let darkGray = Color("DarkGray")
static let darkerGray = Color("DarkerGray")
static let pinkAccentText = Color("PinkAccentText")
}

@ -16,11 +16,11 @@ struct CoinCounterView: View {
.frame(width: 17, height: 17, alignment: .leading) .frame(width: 17, height: 17, alignment: .leading)
Text("541") Text("541")
.fontWeight(.black) .fontWeight(.black)
.foregroundColor(Color("DarkGray")) .foregroundColor(AllinColor.darkGray)
} }
.frame(width: 90, height: 40) .frame(width: 90, height: 40)
.background(Color.white) .background(Color.white)
.cornerRadius(999) .cornerRadius(9999, corners: [.topLeft, .bottomLeft])
} }

@ -25,8 +25,6 @@ struct TopBarView: View {
} }
.frame(width: geometry.size.width,alignment: .trailing) .frame(width: geometry.size.width,alignment: .trailing)
.padding(.trailing, 20)
Image("Icon") Image("Icon")
.resizable() .resizable()
.frame(width: 40, height: 40, alignment: .bottom) .frame(width: 40, height: 40, alignment: .bottom)

@ -0,0 +1,59 @@
//
// TrendingBetCard.swift
// AllIn
//
// Created by étudiant on 21/09/2023.
//
import SwiftUI
struct TrendingBetCard: View {
var body: some View {
VStack(alignment: .leading){
HStack{
Image("Trending")
.resizable()
.frame(width: 15, height: 15, alignment: .leading)
Text("Populaire")
.fontWeight(.medium)
.foregroundColor(AllinColor.pinkAccentText)
}.padding([.leading,.top],10)
Text("Emre va réussir son TP de CI/CD mercredi?")
.frame(height: 47)
.fontWeight(.heavy)
.foregroundColor(Color.white)
.multilineTextAlignment(.leading)
.padding([.leading,.trailing],33)
.font(.system(size: 17))
Spacer()
GeometryReader { geometry in HStack(alignment: .center,spacing: 0){
Text("12")
.fontWeight(.bold)
.foregroundColor(AllinColor.pinkAccentText)
.font(.system(size: 14))
Text("joueurs")
.fontWeight(.regular)
.foregroundColor(Color.white).padding([.leading],2)
.font(.system(size: 14))
Text("2.35k")
.fontWeight(.bold)
.foregroundColor(AllinColor.pinkAccentText)
.padding([.leading],10)
.font(.system(size: 14))
Text("points misés")
.fontWeight(.regular)
.foregroundColor(Color.white).padding([.leading],2)
.font(.system(size: 14))
}.padding([.leading,.bottom,.trailing],5).frame( width: geometry.size.width,height:geometry.size.height, alignment: .bottom)}
}.frame(width: 344, height: 127, alignment: .topLeading).background(AllinColor.darkerGray)
.clipShape(RoundedRectangle(cornerRadius: 17, style: .continuous))
}
}
struct TrendingBetCard_Previews: PreviewProvider {
static var previews: some View {
TrendingBetCard()
}
}
Loading…
Cancel
Save