2022-11-11 23:20:13 +05:30
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct OpenVideosButton: View {
|
|
|
|
var text: String?
|
|
|
|
var imageSystemName: String?
|
|
|
|
var action: () -> Void = {}
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
Button(action: action) {
|
2022-11-12 07:09:44 +05:30
|
|
|
HStack(spacing: 8) {
|
2022-11-11 23:20:13 +05:30
|
|
|
if let imageSystemName {
|
|
|
|
Image(systemName: imageSystemName)
|
|
|
|
}
|
|
|
|
if let text {
|
2022-11-19 04:36:13 +05:30
|
|
|
Text(text.localized())
|
2022-11-11 23:20:13 +05:30
|
|
|
.fontWeight(.bold)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.padding(.vertical, 10)
|
|
|
|
.frame(minHeight: 45)
|
|
|
|
.frame(maxWidth: .infinity)
|
|
|
|
.contentShape(Rectangle())
|
|
|
|
}
|
|
|
|
.foregroundColor(.accentColor)
|
|
|
|
.buttonStyle(.plain)
|
|
|
|
.background(buttonBackground)
|
|
|
|
}
|
|
|
|
|
|
|
|
var buttonBackground: some View {
|
|
|
|
RoundedRectangle(cornerRadius: 4)
|
|
|
|
.foregroundColor(Color.accentColor.opacity(0.33))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct OpenVideosButton_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
OpenVideosButton(text: "Open Videos", imageSystemName: "play.circle.fill")
|
|
|
|
}
|
|
|
|
}
|