Use type native style view modifiers
This commit is contained in:
parent
d4fe83be14
commit
4ea5ec7efe
13 changed files with 44 additions and 43 deletions
|
|
@ -32,13 +32,13 @@ public struct ServerSetupView: View {
|
||||||
Button("Connect") {
|
Button("Connect") {
|
||||||
connect()
|
connect()
|
||||||
}
|
}
|
||||||
.style("suggested-action")
|
.suggested()
|
||||||
if isLoading {
|
if isLoading {
|
||||||
Spinner()
|
Spinner()
|
||||||
}
|
}
|
||||||
if let error {
|
if let error {
|
||||||
Text(error)
|
Text(error)
|
||||||
.style("error")
|
.error()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding()
|
.padding()
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ struct LibraryGrid: View {
|
||||||
var view: Body {
|
var view: Body {
|
||||||
VStack(spacing: 16) {
|
VStack(spacing: 16) {
|
||||||
Text(title ?? "Libraries")
|
Text(title ?? "Libraries")
|
||||||
.style("title-3")
|
.title3()
|
||||||
.halign(.start)
|
.halign(.start)
|
||||||
.padding(10, .horizontal)
|
.padding(10, .horizontal)
|
||||||
FlowBox(libraries) { library in
|
FlowBox(libraries) { library in
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ struct MediaRow: View {
|
||||||
VStack(spacing: 16) {
|
VStack(spacing: 16) {
|
||||||
HStack {
|
HStack {
|
||||||
Text(title)
|
Text(title)
|
||||||
.style("title-3")
|
.title3()
|
||||||
|
|
||||||
/// Poor man's `Spacer()`
|
/// Poor man's `Spacer()`
|
||||||
Bin()
|
Bin()
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,10 @@ struct PersonCell: View {
|
||||||
VStack {
|
VStack {
|
||||||
Avatar(showInitials: false, size: 60)
|
Avatar(showInitials: false, size: 60)
|
||||||
Text(person.name ?? "")
|
Text(person.name ?? "")
|
||||||
.style("caption")
|
.caption()
|
||||||
if let role = person.role {
|
if let role = person.role {
|
||||||
Text(role)
|
Text(role)
|
||||||
.style("caption")
|
.caption()
|
||||||
.dimLabel()
|
.dimLabel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ struct RatingBadge: View {
|
||||||
var view: Body {
|
var view: Body {
|
||||||
HStack {
|
HStack {
|
||||||
Text("\u{2605}")
|
Text("\u{2605}")
|
||||||
.style("accent")
|
.accent()
|
||||||
Text(String(format: "%.1f", rating))
|
Text(String(format: "%.1f", rating))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,27 +50,27 @@ struct EpisodeRow: View {
|
||||||
.frame(minWidth: 100, minHeight: 56)
|
.frame(minWidth: 100, minHeight: 56)
|
||||||
.frame(maxWidth: 100)
|
.frame(maxWidth: 100)
|
||||||
.frame(maxHeight: 56)
|
.frame(maxHeight: 56)
|
||||||
.style("card")
|
.card()
|
||||||
} else {
|
} else {
|
||||||
Box(spacing: 0) {}
|
Box(spacing: 0) {}
|
||||||
.frame(minWidth: 100, minHeight: 56)
|
.frame(minWidth: 100, minHeight: 56)
|
||||||
.frame(maxWidth: 100)
|
.frame(maxWidth: 100)
|
||||||
.frame(maxHeight: 56)
|
.frame(maxHeight: 56)
|
||||||
.style("card")
|
.card()
|
||||||
}
|
}
|
||||||
VStack {
|
VStack {
|
||||||
Text("\(episode.indexNumber ?? 0). \(episode.name ?? "")")
|
Text("\(episode.indexNumber ?? 0). \(episode.name ?? "")")
|
||||||
.style("body")
|
.body()
|
||||||
.halign(.start)
|
.halign(.start)
|
||||||
Text(episode.runtimeString)
|
Text(episode.runtimeString)
|
||||||
.style("caption")
|
.caption()
|
||||||
.halign(.start)
|
.halign(.start)
|
||||||
}
|
}
|
||||||
.hexpand(true)
|
.hexpand(true)
|
||||||
Button(icon: .default(icon: .mediaPlaybackStart)) {
|
Button(icon: .default(icon: .mediaPlaybackStart)) {
|
||||||
|
|
||||||
}
|
}
|
||||||
.style("flat")
|
.flat()
|
||||||
}
|
}
|
||||||
.padding(10, .horizontal)
|
.padding(10, .horizontal)
|
||||||
.onAppear {
|
.onAppear {
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ public struct ItemGrid: View {
|
||||||
VStack {
|
VStack {
|
||||||
if let title {
|
if let title {
|
||||||
Text(title)
|
Text(title)
|
||||||
.style("title-2")
|
.title2()
|
||||||
.halign(.start)
|
.halign(.start)
|
||||||
.padding()
|
.padding()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ struct MovieDetailView: View {
|
||||||
.frame(maxWidth: 200)
|
.frame(maxWidth: 200)
|
||||||
VStack {
|
VStack {
|
||||||
Text(item.name ?? "")
|
Text(item.name ?? "")
|
||||||
.style("title-1")
|
.title1()
|
||||||
.halign(.start)
|
.halign(.start)
|
||||||
HStack {
|
HStack {
|
||||||
if let year = item.productionYear {
|
if let year = item.productionYear {
|
||||||
|
|
@ -52,19 +52,19 @@ struct MovieDetailView: View {
|
||||||
Button("Play", icon: .default(icon: .mediaPlaybackStart)) {
|
Button("Play", icon: .default(icon: .mediaPlaybackStart)) {
|
||||||
|
|
||||||
}
|
}
|
||||||
.style("suggested-action")
|
.suggested()
|
||||||
Button(icon: .default(icon: .bookmarkNew)) {
|
Button(icon: .default(icon: .bookmarkNew)) {
|
||||||
toggleFavorite()
|
toggleFavorite()
|
||||||
}
|
}
|
||||||
Button(isPlayed ? "Mark Unplayed" : "Mark Played") {
|
Button(isPlayed ? "Mark Unplayed" : "Mark Played") {
|
||||||
togglePlayed()
|
togglePlayed()
|
||||||
}
|
}
|
||||||
.style("flat")
|
.flat()
|
||||||
}
|
}
|
||||||
.padding(10, .vertical)
|
.padding(10, .vertical)
|
||||||
if let overview = item.overview {
|
if let overview = item.overview {
|
||||||
Text(overview)
|
Text(overview)
|
||||||
.style("body")
|
.body()
|
||||||
.halign(.start)
|
.halign(.start)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -74,7 +74,7 @@ struct MovieDetailView: View {
|
||||||
if let people = item.people, !people.isEmpty {
|
if let people = item.people, !people.isEmpty {
|
||||||
VStack {
|
VStack {
|
||||||
Text("Cast")
|
Text("Cast")
|
||||||
.style("title-3")
|
.title3()
|
||||||
.halign(.start)
|
.halign(.start)
|
||||||
FlowBox(people) { person in
|
FlowBox(people) { person in
|
||||||
PersonCell(person: person)
|
PersonCell(person: person)
|
||||||
|
|
@ -85,7 +85,7 @@ struct MovieDetailView: View {
|
||||||
if !similarItems.isEmpty {
|
if !similarItems.isEmpty {
|
||||||
VStack {
|
VStack {
|
||||||
Text("Similar")
|
Text("Similar")
|
||||||
.style("title-3")
|
.title3()
|
||||||
.halign(.start)
|
.halign(.start)
|
||||||
ScrollView {
|
ScrollView {
|
||||||
HStack {
|
HStack {
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,10 @@ struct PosterCell: View {
|
||||||
Box(spacing: 0) {}
|
Box(spacing: 0) {}
|
||||||
.frame(maxWidth: 150)
|
.frame(maxWidth: 150)
|
||||||
.frame(maxHeight: 225)
|
.frame(maxHeight: 225)
|
||||||
.style("card")
|
.card()
|
||||||
}
|
}
|
||||||
Text(item.name ?? "")
|
Text(item.name ?? "")
|
||||||
.style("body")
|
.body()
|
||||||
.halign(.center)
|
.halign(.center)
|
||||||
.frame(maxWidth: 150)
|
.frame(maxWidth: 150)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,30 +69,30 @@ struct SearchResultRow: View {
|
||||||
.frame(minWidth: 80, minHeight: 120)
|
.frame(minWidth: 80, minHeight: 120)
|
||||||
.frame(maxWidth: 80)
|
.frame(maxWidth: 80)
|
||||||
.frame(maxHeight: 120)
|
.frame(maxHeight: 120)
|
||||||
.style("card")
|
.card()
|
||||||
} else {
|
} else {
|
||||||
Box(spacing: 0) {}
|
Box(spacing: 0) {}
|
||||||
.frame(minWidth: 80, minHeight: 120)
|
.frame(minWidth: 80, minHeight: 120)
|
||||||
.frame(maxWidth: 80)
|
.frame(maxWidth: 80)
|
||||||
.frame(maxHeight: 120)
|
.frame(maxHeight: 120)
|
||||||
.style("card")
|
.card()
|
||||||
}
|
}
|
||||||
VStack {
|
VStack {
|
||||||
Text(hint.name ?? "")
|
Text(hint.name ?? "")
|
||||||
.style("body")
|
.body()
|
||||||
.halign(.start)
|
.halign(.start)
|
||||||
if let type = hint._type?.value1 {
|
if let type = hint._type?.value1 {
|
||||||
Text("\(type)")
|
Text("\(type)")
|
||||||
.style("caption")
|
.caption()
|
||||||
.halign(.start)
|
.halign(.start)
|
||||||
}
|
}
|
||||||
if let year = hint.productionYear {
|
if let year = hint.productionYear {
|
||||||
Text("\(year)")
|
Text("\(year)")
|
||||||
.style("caption")
|
.caption()
|
||||||
.halign(.start)
|
.halign(.start)
|
||||||
}
|
}
|
||||||
Text(hint.runtimeString)
|
Text(hint.runtimeString)
|
||||||
.style("caption")
|
.caption()
|
||||||
.halign(.start)
|
.halign(.start)
|
||||||
}
|
}
|
||||||
.hexpand(true)
|
.hexpand(true)
|
||||||
|
|
|
||||||
|
|
@ -27,16 +27,16 @@ struct TVShowView: View {
|
||||||
.frame(maxWidth: 200)
|
.frame(maxWidth: 200)
|
||||||
VStack {
|
VStack {
|
||||||
Text(item.name ?? "")
|
Text(item.name ?? "")
|
||||||
.style("title-1")
|
.title1()
|
||||||
.halign(.start)
|
.halign(.start)
|
||||||
if let status = item.status {
|
if let status = item.status {
|
||||||
Text(status)
|
Text(status)
|
||||||
.style("caption")
|
.caption()
|
||||||
.halign(.start)
|
.halign(.start)
|
||||||
}
|
}
|
||||||
if let overview = item.overview {
|
if let overview = item.overview {
|
||||||
Text(overview)
|
Text(overview)
|
||||||
.style("body")
|
.body()
|
||||||
.halign(.start)
|
.halign(.start)
|
||||||
.padding(10, .vertical)
|
.padding(10, .vertical)
|
||||||
}
|
}
|
||||||
|
|
@ -47,14 +47,15 @@ struct TVShowView: View {
|
||||||
if !seasons.isEmpty {
|
if !seasons.isEmpty {
|
||||||
VStack {
|
VStack {
|
||||||
Text("Season")
|
Text("Season")
|
||||||
.style("caption")
|
.caption()
|
||||||
.halign(.start)
|
.halign(.start)
|
||||||
HStack {
|
HStack {
|
||||||
ForEach(seasons) { season in
|
ForEach(seasons) { season in
|
||||||
Button(season.name ?? "?") {
|
Button(season.name ?? "?") {
|
||||||
selectedSeasonId = season.id
|
selectedSeasonId = season.id
|
||||||
}
|
}
|
||||||
.style(selectedSeasonId == season.id ? "suggested-action" : "flat")
|
.suggested(selectedSeasonId == season.id)
|
||||||
|
.flat(selectedSeasonId != season.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,33 +16,33 @@ public struct PlayerControls: View {
|
||||||
Button(icon: .default(icon: .windowClose)) {
|
Button(icon: .default(icon: .windowClose)) {
|
||||||
onClose()
|
onClose()
|
||||||
}
|
}
|
||||||
.style("flat")
|
.flat()
|
||||||
Button(icon: .default(icon: .goPrevious)) {
|
Button(icon: .default(icon: .goPrevious)) {
|
||||||
onSeekBack()
|
onSeekBack()
|
||||||
}
|
}
|
||||||
.style("flat")
|
.flat()
|
||||||
Button(icon: .default(icon: isPlaying ? .mediaPlaybackPause : .mediaPlaybackStart)) {
|
Button(icon: .default(icon: isPlaying ? .mediaPlaybackPause : .mediaPlaybackStart)) {
|
||||||
onTogglePlay()
|
onTogglePlay()
|
||||||
}
|
}
|
||||||
.style("flat")
|
.flat()
|
||||||
Button(icon: .default(icon: .goNext)) {
|
Button(icon: .default(icon: .goNext)) {
|
||||||
onSeekForward()
|
onSeekForward()
|
||||||
}
|
}
|
||||||
.style("flat")
|
.flat()
|
||||||
HStack {
|
HStack {
|
||||||
Text(formatTime(position))
|
Text(formatTime(position))
|
||||||
.style("caption")
|
.caption()
|
||||||
LevelBar()
|
LevelBar()
|
||||||
.value(duration > 0 ? position / duration : 0)
|
.value(duration > 0 ? position / duration : 0)
|
||||||
.hexpand(true)
|
.hexpand(true)
|
||||||
Text(formatTime(duration))
|
Text(formatTime(duration))
|
||||||
.style("caption")
|
.caption()
|
||||||
}
|
}
|
||||||
.hexpand(true)
|
.hexpand(true)
|
||||||
Button(icon: .default(icon: .viewFullscreen)) {
|
Button(icon: .default(icon: .viewFullscreen)) {
|
||||||
onFullscreen()
|
onFullscreen()
|
||||||
}
|
}
|
||||||
.style("flat")
|
.flat()
|
||||||
}
|
}
|
||||||
.padding(10)
|
.padding(10)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,19 +11,19 @@ struct VideoPlayerWidget: View {
|
||||||
var view: Body {
|
var view: Body {
|
||||||
VStack {
|
VStack {
|
||||||
Text("Now Playing")
|
Text("Now Playing")
|
||||||
.style("title-1")
|
.title1()
|
||||||
Text(url)
|
Text(url)
|
||||||
.style("caption")
|
.caption()
|
||||||
.dimLabel()
|
.dimLabel()
|
||||||
HStack {
|
HStack {
|
||||||
Button(icon: .default(icon: .mediaPlaybackStart)) {
|
Button(icon: .default(icon: .mediaPlaybackStart)) {
|
||||||
isPlaying = true
|
isPlaying = true
|
||||||
}
|
}
|
||||||
.style("suggested-action")
|
.suggested()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(50)
|
.padding(50)
|
||||||
.frame(minWidth: 400, minHeight: 300)
|
.frame(minWidth: 400, minHeight: 300)
|
||||||
.style("card")
|
.card()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue