mirror of
https://github.com/yattee/yattee.git
synced 2026-02-20 09:49:46 +00:00
Yattee v2 rewrite
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// CardBackgroundModifier.swift
|
||||
// Yattee
|
||||
//
|
||||
// Reusable card background modifier for grouped list items.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
/// Applies platform-appropriate card background with rounded corners.
|
||||
///
|
||||
/// Uses `ListBackgroundStyle.card` for consistent appearance across platforms.
|
||||
struct CardBackgroundModifier: ViewModifier {
|
||||
var cornerRadius: CGFloat = 10
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
content
|
||||
.background(ListBackgroundStyle.card.color)
|
||||
.clipShape(RoundedRectangle(cornerRadius: cornerRadius))
|
||||
}
|
||||
}
|
||||
|
||||
extension View {
|
||||
/// Applies card background styling used in grouped lists.
|
||||
///
|
||||
/// - Parameter cornerRadius: The corner radius for the rounded rectangle. Defaults to 10.
|
||||
/// - Returns: A view with card background applied.
|
||||
func cardBackground(cornerRadius: CGFloat = 10) -> some View {
|
||||
modifier(CardBackgroundModifier(cornerRadius: cornerRadius))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user