2021-09-14 21:38:12 -07:00
|
|
|
/*
|
|
|
|
|
Abstract:
|
2021-09-18 15:33:35 -07:00
|
|
|
A view draws a circle in the background of the shortName text
|
2021-09-14 21:38:12 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
|
|
struct CircleText: View {
|
|
|
|
|
var text: String
|
2021-09-18 15:33:35 -07:00
|
|
|
var color: Color
|
2022-01-02 23:28:51 -08:00
|
|
|
var circleSize: CGFloat? = 50
|
2022-02-16 07:37:08 -08:00
|
|
|
var fontSize: CGFloat? = 22
|
2021-09-14 21:38:12 -07:00
|
|
|
|
|
|
|
|
var body: some View {
|
2022-01-02 10:05:13 -08:00
|
|
|
|
|
|
|
|
let font = Font.system(size: fontSize!)
|
|
|
|
|
|
2021-09-24 00:39:36 -07:00
|
|
|
ZStack {
|
|
|
|
|
Circle()
|
|
|
|
|
.fill(color)
|
2022-01-02 10:05:13 -08:00
|
|
|
.frame(width: circleSize, height: circleSize)
|
2022-02-23 23:05:47 -10:00
|
|
|
Text(text).textCase(.uppercase).font(font).foregroundColor(.white).fixedSize()
|
2022-01-02 10:05:13 -08:00
|
|
|
.frame(width: circleSize, height: circleSize, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/).offset(x: 0, y: 0)
|
2021-09-24 00:39:36 -07:00
|
|
|
}
|
2021-09-14 21:38:12 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct CircleText_Previews: PreviewProvider {
|
|
|
|
|
static var previews: some View {
|
2021-10-17 20:30:04 -07:00
|
|
|
CircleText(text: "RDN", color: Color.accentColor)
|
2021-09-18 17:10:22 -07:00
|
|
|
.previewLayout(.fixed(width: 300, height: 100))
|
2021-09-14 21:38:12 -07:00
|
|
|
}
|
|
|
|
|
}
|