34 lines
696 B
Swift
34 lines
696 B
Swift
|
import SwiftUI
|
||
|
|
||
|
struct TagView: View {
|
||
|
|
||
|
let text: String
|
||
|
|
||
|
let rounding: CGFloat
|
||
|
|
||
|
let color: Color
|
||
|
|
||
|
init(_ text: String, rounding: CGFloat, color: Color) {
|
||
|
self.text = text
|
||
|
self.rounding = rounding
|
||
|
self.color = color
|
||
|
}
|
||
|
|
||
|
var body: some View {
|
||
|
Text(text)
|
||
|
.fontWeight(.light)
|
||
|
.padding(.horizontal, rounding)
|
||
|
.padding(.vertical, 3)
|
||
|
.background(
|
||
|
RoundedRectangle(cornerRadius: rounding)
|
||
|
.fill(color)
|
||
|
)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
struct TagView_Previews: PreviewProvider {
|
||
|
static var previews: some View {
|
||
|
TagView("Text", rounding: 8, color: .gray)
|
||
|
}
|
||
|
}
|