Gradient for sub club posts
This commit is contained in:
parent
49ce369275
commit
100d788749
|
@ -37,6 +37,7 @@ struct CompactPostView: View {
|
|||
}
|
||||
.withCovers(sheetDestination: $navigator.presentedCover)
|
||||
.containerShape(Rectangle())
|
||||
.background(postBackground())
|
||||
.contextMenu {
|
||||
PostMenu(status: status)
|
||||
}
|
||||
|
@ -285,6 +286,24 @@ struct CompactPostView: View {
|
|||
quoteStatus = nil
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Sub Club integration
|
||||
|
||||
@ViewBuilder
|
||||
private func postBackground() -> some View {
|
||||
ZStack {
|
||||
if let match = status.account.acct.firstMatch(of: /(@)?[A-Za-z0-9_]+@sub\.club/) {
|
||||
LinearGradient(
|
||||
stops: [.init(color: Color.subClub, location: 0.0), .init(color: Color.appBackground, location: 0.2)],
|
||||
startPoint: .topTrailing,
|
||||
endPoint: .bottomLeading
|
||||
)
|
||||
.opacity(0.2)
|
||||
} else {
|
||||
Color.appBackground
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
|
|
Loading…
Reference in New Issue