Initial commit
This commit is contained in:
39
WhiteNights/Utils/View+Extensions.swift
Normal file
39
WhiteNights/Utils/View+Extensions.swift
Normal file
@ -0,0 +1,39 @@
|
||||
import SwiftUI
|
||||
|
||||
struct BlockStyle: ViewModifier {
|
||||
// Добавляем свойство для хранения радиуса скругления
|
||||
let cornerRadius: CGFloat
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
content
|
||||
.background(
|
||||
ZStack {
|
||||
Color(hex: 0x806C59)
|
||||
LinearGradient(
|
||||
stops: [
|
||||
.init(color: .white.opacity(0.0), location: 0.0871),
|
||||
.init(color: .white.opacity(0.16), location: 0.6969)
|
||||
],
|
||||
startPoint: .bottomLeading,
|
||||
endPoint: .topTrailing
|
||||
)
|
||||
}
|
||||
.cornerRadius(cornerRadius) // Применяем скругление к фону
|
||||
)
|
||||
.shadow(
|
||||
color: Color.black.opacity(0.10),
|
||||
radius: 8,
|
||||
x: 0,
|
||||
y: 2
|
||||
)
|
||||
// Применяем скругление к содержимому (опционально, но лучше для теней)
|
||||
.cornerRadius(cornerRadius)
|
||||
}
|
||||
}
|
||||
|
||||
extension View {
|
||||
// Изменяем расширение, чтобы оно принимало параметр cornerRadius
|
||||
func blockStyle(cornerRadius: CGFloat) -> some View {
|
||||
modifier(BlockStyle(cornerRadius: cornerRadius))
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user