Skip to content

Commit

Permalink
PLAYNEXT-832 Introduce a title style for hero stage cells
Browse files Browse the repository at this point in the history
  • Loading branch information
pyby committed Oct 2, 2024
1 parent f91d106 commit de43dd5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions Application/Sources/UI/Helpers/MediaDescription.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import SRGAppearanceSwift
case date
/// Time information emphasis
case time
/// Title information emphasis
case title
}

static func title(for media: SRGMedia, style: Style) -> String? {
Expand All @@ -32,6 +34,8 @@ import SRGAppearanceSwift
}
case .date, .time:
media.title
case .title:
media.title
}
}

Expand Down Expand Up @@ -59,6 +63,12 @@ import SRGAppearanceSwift
} else {
return formattedTime(for: media)
}
case .title:
if let show = media.show, !areRedundant(media: media, show: show) {
return show.title
} else {
return summary(for: media)
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions Application/Sources/UI/Views/HeroMediaCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ struct HeroMediaCell: View {

private var subtitle: String? {
guard let media else { return nil }
return MediaDescription.subtitle(for: media, style: .show)
return MediaDescription.subtitle(for: media, style: .title)
}

private var title: String? {
guard let media else { return nil }
return MediaDescription.title(for: media, style: .show)
return MediaDescription.title(for: media, style: .title)
}

var body: some View {
Expand Down

0 comments on commit de43dd5

Please sign in to comment.