Improve page and post detail views
This commit is contained in:
36
CHDataManagement/Views/Generic/IconButton.swift
Normal file
36
CHDataManagement/Views/Generic/IconButton.swift
Normal file
@ -0,0 +1,36 @@
|
||||
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))
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user