comparison LazyBear/Views/Company/Helpers/KeyStatsRow.swift @ 448:f71761f166f2

Handle when data is empty
author Dennis Concepción Martín <dennisconcepcionmartin@gmail.com>
date Wed, 23 Jun 2021 11:47:14 +0200
parents
children
comparison
equal deleted inserted replaced
447:8621ba6fd457 448:f71761f166f2
1 //
2 // KeyStatsRow.swift
3 // LazyBear
4 //
5 // Created by Dennis Concepción Martín on 23/6/21.
6 //
7
8 import SwiftUI
9
10 struct KeyStatsRow: View {
11 var label: String
12 @Environment(\.colorScheme) private var colorScheme
13
14 var body: some View {
15 HStack {
16 Text("\(label)")
17 .font(.callout)
18 .fontWeight(.semibold)
19 .lineLimit(1)
20
21 }
22 .padding()
23 .background(
24 Capsule()
25 .frame(height: 40)
26 .foregroundColor(Color("customSecondaryBackground"))
27 .if(colorScheme == .light) { content in
28 content.shadow(color: Color(.systemGray).opacity(0.25), radius: 10, x: 0.0, y: 0.0)
29 }
30 )
31 }
32 }
33
34 struct KeyStatsRow_Previews: PreviewProvider {
35 static var previews: some View {
36 KeyStatsRow(label: "Company Name")
37 }
38 }