refactor into smaller units
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// ButtonView.swift
|
||||
// Bunch O' Dice
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ButtonView: View {
|
||||
let color: CGColor
|
||||
let label: String
|
||||
let value: Int
|
||||
|
||||
var body: some View {
|
||||
let frameSize = 120.0
|
||||
let fontSize = 35.0
|
||||
let blurSize = 5.0
|
||||
|
||||
ZStack {
|
||||
Circle()
|
||||
.fill(Color(color))
|
||||
.frame(width: frameSize, height: frameSize)
|
||||
.blur(radius: blurSize)
|
||||
VStack {
|
||||
Text(String(value))
|
||||
.fontWeight(.black)
|
||||
Text(label)
|
||||
.font(.system(size: 20))
|
||||
}
|
||||
}
|
||||
.foregroundColor(.primary)
|
||||
.font(.system(size: fontSize))
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
ButtonView(
|
||||
color: CGColor(red: 1.0, green: 0.3, blue: 0.3, alpha: 1.0),
|
||||
label: "Hits",
|
||||
value: 12
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user