Files
letro-ios/ElementX/Sources/Other/SwiftUI/Views/HorizontalHighlightGradient.swift
Doug 3862929356 Update and enable the new bloom style on the home screen. (#4291)
* Update Compound

* Adopt the new accent colour (and gradient) tokens.
2025-07-07 11:23:03 +01:00

37 lines
1.1 KiB
Swift

//
// Copyright 2025 New Vector Ltd.
//
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
// Please see LICENSE files in the repository root for full details.
//
import Compound
import SwiftUI
extension View {
func highlight(gradient: Gradient, borderColor: Color, backgroundColor: Color = .clear) -> some View {
modifier(HorizontalHighlightGradient(gradient: gradient, borderColor: borderColor, backgroundColor: backgroundColor))
}
}
struct HorizontalHighlightGradient: ViewModifier {
let gradient: Gradient
let borderColor: Color
let backgroundColor: Color
func body(content: Content) -> some View {
ZStack(alignment: .top) {
VStack(spacing: 0) {
borderColor
.frame(height: 1)
LinearGradient(gradient: gradient,
startPoint: .top,
endPoint: .bottom)
.background(backgroundColor)
}
content
.layoutPriority(1)
}
}
}