//
//  BorderView.swift
//  USB Meter
//
//  Created by Bogdan Timofte on 11/04/2020.
//  Copyright © 2020 Bogdan Timofte. All rights reserved.
//

import SwiftUI

struct BorderView: View {
    let show: Bool
    var fillColor: Color = .clear
    var opacity = 0.5
    
    var body: some View {
        ZStack {
        RoundedRectangle(cornerRadius: 10)
            .foregroundColor(fillColor).opacity(opacity)

        RoundedRectangle(cornerRadius: 10)
            .stroke(lineWidth: 3.0).foregroundColor(show ? fillColor : Color.clear)
            .animation(.linear(duration: 0.1), value: show)
        }
    }
}

struct BorderView_Previews: PreviewProvider {
    static var previews: some View {
        BorderView(show: true)
    }
}
