Remove layout styling abstraction (#2982)

This commit is contained in:
Mauro
2024-06-27 18:25:25 +02:00
committed by GitHub
parent 064b1bf224
commit b7345aafca
22 changed files with 29 additions and 126 deletions
@@ -17,26 +17,6 @@
import Foundation
import SwiftUI
enum TimelineStyle: String, CaseIterable, Codable {
case bubbles
/// List row insets for a timeline
var rowInsets: EdgeInsets {
switch self {
case .bubbles:
return EdgeInsets(top: 1, leading: 8, bottom: 1, trailing: 8)
}
}
/// Short hand for `self == .bubbles`
var isBubbles: Bool {
switch self {
case .bubbles:
return true
}
}
}
enum TimelineGroupStyle: Hashable {
case single
case first
@@ -55,20 +35,11 @@ enum TimelineGroupStyle: Hashable {
// MARK: - Environment
private struct TimelineStyleKey: EnvironmentKey {
static let defaultValue = TimelineStyle.bubbles
}
private struct TimelineGroupStyleKey: EnvironmentKey {
static let defaultValue = TimelineGroupStyle.single
}
extension EnvironmentValues {
var timelineStyle: TimelineStyle {
get { self[TimelineStyleKey.self] }
set { self[TimelineStyleKey.self] = newValue }
}
var timelineGroupStyle: TimelineGroupStyle {
get { self[TimelineGroupStyleKey.self] }
set { self[TimelineGroupStyleKey.self] = newValue }