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