Move level badge to top-left and free badge to top-right in FeaturedProgramCard

This commit is contained in:
Millian Lamiaux
2026-04-22 00:54:42 +02:00
parent 0f5b7b9e18
commit d74c47b1a8

View File

@@ -152,7 +152,7 @@ struct FeaturedProgramCard: View {
.fill(Theme.zoneGradient(program.bodyZone))
.frame(width: 220, height: 170)
.overlay {
ZStack(alignment: .topTrailing) {
ZStack {
// Bottom scrim for text legibility
LinearGradient(
colors: [.clear, .black.opacity(0.55)],
@@ -161,7 +161,7 @@ struct FeaturedProgramCard: View {
)
.clipShape(RoundedRectangle(cornerRadius: 20, style: .continuous))
// Level tag top right
// Level tag top left
Text(program.level.capitalized)
.font(.caption2.weight(.bold))
.foregroundStyle(.white)
@@ -169,8 +169,22 @@ struct FeaturedProgramCard: View {
.padding(.vertical, 5)
.background(.ultraThinMaterial.opacity(0.85))
.clipShape(RoundedRectangle(cornerRadius: 8, style: .continuous))
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
.padding(12)
// Free badge top right
if program.isFree {
Label(String(localized: L10n.home.free), systemImage: "checkmark.seal.fill")
.font(.caption2.weight(.bold))
.foregroundStyle(Color(red: 0.45, green: 1.0, blue: 0.65))
.padding(.horizontal, 9)
.padding(.vertical, 5)
.background(.ultraThinMaterial.opacity(0.85))
.clipShape(RoundedRectangle(cornerRadius: 8, style: .continuous))
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topTrailing)
.padding(12)
}
// Bottom content
VStack(alignment: .leading, spacing: 6) {
Spacer()
@@ -184,10 +198,6 @@ struct FeaturedProgramCard: View {
HStack(spacing: 10) {
Label("\(program.estimatedDuration)m", systemImage: "clock.fill")
Label("\(program.estimatedCalories) kcal", systemImage: "flame.fill")
if program.isFree {
Label(String(localized: L10n.home.free), systemImage: "checkmark.seal.fill")
.foregroundStyle(Theme.success)
}
}
.font(.caption.weight(.semibold))
.foregroundStyle(.white.opacity(0.9))