velib-tracker/velibtracker/components/StationComponent.swift
Louis 701d163547
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
2023-09-02 17:19:40 +02:00

49 lines
1.0 KiB
Swift

//
// 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])
}
}