34 lines
832 B
Swift
34 lines
832 B
Swift
import SwiftUI
|
|
|
|
struct TextIndicator: View {
|
|
|
|
let text: LocalizedStringKey
|
|
|
|
let color: Color
|
|
|
|
let background: Color
|
|
|
|
init(text: String, color: Color = .white, background: Color = Color.gray) {
|
|
self.text = .init(stringLiteral: text)
|
|
self.background = background
|
|
self.color = color
|
|
}
|
|
|
|
init(text: LocalizedStringKey, color: Color = .white, background: Color = Color.gray) {
|
|
self.text = text
|
|
self.background = background
|
|
self.color = color
|
|
}
|
|
|
|
var body: some View {
|
|
Text(text)
|
|
.foregroundStyle(color)
|
|
.padding(.vertical, 2)
|
|
.padding(.horizontal, 5)
|
|
.background(
|
|
RoundedRectangle(cornerRadius: 5, style: .circular)
|
|
.foregroundStyle(background)
|
|
)
|
|
}
|
|
}
|