2024-12-14 19:23:12 +01:00

38 lines
884 B
Swift

import SwiftUI
import SFSafeSymbols
struct IconButton: View {
let symbol: SFSymbol
let action: () -> Void
let size: CGFloat
let color: Color
let background: Color
init(symbol: SFSymbol, size: CGFloat, color: Color, background: Color = .white, action: @escaping () -> Void) {
self.symbol = symbol
self.action = action
self.size = size
self.color = color
self.background = background
}
var body: some View {
Button(action: action) {
Image(systemSymbol: symbol)
.resizable()
.aspectRatio(1, contentMode: .fit)
.frame(width: size, height: size)
.foregroundStyle(color)
.background(Circle()
.fill(background)
.padding(1))
}
.buttonStyle(.plain)
}
}