Update fallback images for grid cards

This commit is contained in:
Jackson Harper
2023-12-08 15:27:51 +08:00
parent 6259311812
commit d8422bb92b

View File

@ -107,18 +107,26 @@ public struct GridCard: View {
.cornerRadius(5)
}
var fallbackFont: Font {
if let uifont = UIFont(name: "Futura Bold", size: 16) {
return Font(uifont)
}
return Font.system(size: 16)
}
var fallbackImage: some View {
GeometryReader { geo in
HStack {
Text(item.unwrappedTitle.prefix(1))
.font(Font.system(size: 128, weight: .bold))
.offset(CGSize(width: -48, height: 12))
.frame(alignment: .bottomLeading)
.foregroundColor(Gradient.randomColor(str: item.unwrappedTitle, offset: 1))
Text(item.unwrappedTitle)
.font(fallbackFont)
.frame(alignment: .center)
.multilineTextAlignment(.leading)
.lineLimit(2)
.padding(10)
.foregroundColor(Color.themeMiddleGray)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Gradient.randomColor(str: item.unwrappedTitle, offset: 0))
.background(LinearGradient(gradient: Gradient(fromStr: item.unwrappedTitle)!, startPoint: .top, endPoint: .bottom))
.background(Color.thLightWhiteGrey)
.frame(width: geo.size.width, height: geo.size.height)
}
}