ProductView.swift 1.01 KB
Newer Older
 Joel  Oksanen's avatar
Joel Oksanen committed
1
2
3
4
5
6
7
8
9
10
11
//
//  ProductView.swift
//  ADAbot
//
//  Created by Joel Oksanen on 23.2.2020.
//  Copyright © 2020 Joel Oksanen. All rights reserved.
//

import SwiftUI

struct ProductView: View {
12
  @ObservedObject var connectionManager = ConnectionManager()
13
  let height: CGFloat = 200
 Joel  Oksanen's avatar
Joel Oksanen committed
14
15
16
  
  var body: some View {
    ZStack {
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
      Rectangle()
        .foregroundColor(Color.white)
        .frame(height: height)
      .shadow(color: Color(.sRGB, white: 0, opacity: 0.05), radius: 20, x: 0, y: 8)
      
      VStack {
        Spacer()
        HStack(alignment: .top) {
          Text(connectionManager.product.name)
            .foregroundColor(Color.gray)
          Spacer()
          Image(uiImage: connectionManager.product.image)
            .resizable()
            .aspectRatio(contentMode: .fit)
            .frame(width: 120, height: 120)
            .border(Color(white: 0.85), width: 1)
        }
        .padding(EdgeInsets(top: 0, leading: 20, bottom: 20, trailing: 20))
      }
      .frame(height: height)
      
 Joel  Oksanen's avatar
Joel Oksanen committed
38
    }
39
    
 Joel  Oksanen's avatar
Joel Oksanen committed
40
41
  }
}