yattee/Shared/Views/HideShortsButtons.swift

35 lines
866 B
Swift
Raw Normal View History

2023-05-23 16:54:53 +00:00
import Defaults
2023-02-25 15:42:18 +00:00
import SwiftUI
struct HideShortsButtons: View {
2023-05-23 16:54:53 +00:00
@Default(.hideShorts) private var hideShorts
2023-02-25 15:42:18 +00:00
var body: some View {
Button {
2023-05-23 16:54:53 +00:00
hideShorts.toggle()
2023-02-25 15:42:18 +00:00
} label: {
Group {
2023-05-23 16:54:53 +00:00
if hideShorts {
2023-02-25 15:42:18 +00:00
Label("Short videos: hidden", systemImage: "bolt.slash.fill")
.help("Short videos: hidden")
} else {
Label("Short videos: visible", systemImage: "bolt.fill")
.help("Short videos: visible")
}
}
#if os(tvOS)
.font(.caption)
2023-02-25 15:42:18 +00:00
.imageScale(.small)
#endif
}
}
}
struct HideShortsButtons_Previews: PreviewProvider {
static var previews: some View {
VStack {
2023-05-23 16:54:53 +00:00
HideShortsButtons()
2023-02-25 15:42:18 +00:00
}
}
}