feat: ✨ Ability to view stations from the API
Addition of a single component for stations; creation of structure; creation of function to retrieve bikes in real time
This commit is contained in:
48
velibtracker/components/StationComponent.swift
Normal file
48
velibtracker/components/StationComponent.swift
Normal file
@ -0,0 +1,48 @@
|
||||
//
|
||||
// StationComponent.swift
|
||||
// velibtracker
|
||||
//
|
||||
// Created by Louis Gallet on 02/09/2023.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct StationComponent: View {
|
||||
|
||||
let station: VelibStation
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
Text(station.name)
|
||||
.font(.title)
|
||||
.foregroundColor(.primary)
|
||||
|
||||
HStack {
|
||||
Text("Capacité: \(station.capacity)")
|
||||
.font(.subheadline)
|
||||
.foregroundColor(.secondary)
|
||||
|
||||
Spacer()
|
||||
|
||||
Text("Disponibles: \(station.numbikesavailable)")
|
||||
.font(.subheadline)
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
.background(Color.white)
|
||||
.cornerRadius(10)
|
||||
.shadow(radius: 5)
|
||||
.padding(.horizontal, 16)
|
||||
.padding(.vertical, 8)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct StationComponent_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
StationComponent(station: test[1])
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user