USB-Meter / USB Meter / Views / Meter / Tabs / Settings / Subviews / MeterScreenControlButtonView.swift
Newer Older
36 lines | 1.076kb
Bogdan Timofte authored a week ago
1
//
Bogdan Timofte authored a week ago
2
//  MeterScreenControlButtonView.swift
Bogdan Timofte authored a week ago
3
//  USB Meter
4
//
5
//  Created by Bogdan Timofte on 29/03/2026.
6
//  Co-authored-by: GPT-5.3-Codex.
7
//  Copyright © 2026 Bogdan Timofte. All rights reserved.
8
//
9

            
10
import SwiftUI
11

            
Bogdan Timofte authored a week ago
12
struct MeterScreenControlButtonView: View {
Bogdan Timofte authored a week ago
13
    let title: String
14
    let symbol: String
15
    let tint: Color
16
    let compact: Bool
17
    let isExpandedCompactLayout: Bool
18
    let action: () -> Void
19

            
20
    var body: some View {
21
        Button(action: action) {
22
            VStack(spacing: 10) {
23
                Image(systemName: symbol)
24
                    .font(.system(size: compact ? 18 : 20, weight: .semibold))
25
                Text(title)
26
                    .font(.footnote.weight(.semibold))
27
                    .multilineTextAlignment(.center)
28
            }
29
            .foregroundColor(tint)
30
            .frame(maxWidth: .infinity, minHeight: compact ? (isExpandedCompactLayout ? 112 : 92) : 68)
31
            .padding(.horizontal, 8)
32
            .meterCard(tint: tint, fillOpacity: 0.10, strokeOpacity: 0.14)
33
        }
34
        .buttonStyle(.plain)
35
    }
36
}