mirror of
https://github.com/home-assistant/iOS.git
synced 2026-02-04 02:46:35 -06:00
Refactored WidgetBasicView to improve layout handling for compact and single-column widgets, including max height constraints and dynamic spacing. Moved corner radius logic in TileCardStyleModifier to a computed property for clarity. Updated DesignSystem corner radius constants for better documentation and added missing values. <!-- Thank you for submitting a Pull Request and helping to improve Home Assistant. Please complete the following sections to help the processing and review of your changes. Please do not delete anything from this template. --> ## Summary <!-- Provide a brief summary of the changes you have made and most importantly what they aim to achieve --> ## Screenshots <!-- If this is a user-facing change not in the frontend, please include screenshots in light and dark mode. --> <img width="2760" height="2320" alt="CleanShot 2026-01-28 at 14 50 06@2x" src="https://github.com/user-attachments/assets/2045b737-18f7-41a2-b1f7-bafa8093f36c" /> ## Link to pull request in Documentation repository <!-- Pull requests that add, change or remove functionality must have a corresponding pull request in the Companion App Documentation repository (https://github.com/home-assistant/companion.home-assistant). Please add the number of this pull request after the "#" --> Documentation: home-assistant/companion.home-assistant# ## Any other notes <!-- If there is any other information of note, like if this Pull Request is part of a bigger change, please include it here. --> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
87 lines
2.9 KiB
Swift
87 lines
2.9 KiB
Swift
import Foundation
|
|
import SwiftUI
|
|
|
|
public enum DesignSystem {
|
|
// TODO: Use HA design system font sizes when ready
|
|
public enum Font {
|
|
/// Large Title (34pt)
|
|
public static let largeTitle: SwiftUICore.Font = .largeTitle
|
|
/// Title (28pt)
|
|
public static let title: SwiftUICore.Font = .title
|
|
/// Title2 (22pt)
|
|
public static let title2: SwiftUICore.Font = .title2
|
|
/// Title3 (20pt)
|
|
public static let title3: SwiftUICore.Font = .title3
|
|
/// Headline (17pt, semibold)
|
|
public static let headline: SwiftUICore.Font = .headline
|
|
/// Body (17pt)
|
|
public static let body: SwiftUICore.Font = .body
|
|
/// Callout (16pt)
|
|
public static let callout: SwiftUICore.Font = .callout
|
|
/// Subheadline (15pt)
|
|
public static let subheadline: SwiftUICore.Font = .subheadline
|
|
/// Footnote (13pt)
|
|
public static let footnote: SwiftUICore.Font = .footnote
|
|
/// Caption (12pt)
|
|
public static let caption: SwiftUICore.Font = .caption
|
|
/// Caption2 (11pt)
|
|
public static let caption2: SwiftUICore.Font = .caption2
|
|
/// Caption3 (10pt)
|
|
public static let caption3: SwiftUICore.Font = .system(size: 10)
|
|
}
|
|
|
|
public enum Spaces {
|
|
public static let half: CGFloat = 4
|
|
public static let one: CGFloat = 8
|
|
public static let oneAndHalf: CGFloat = 12
|
|
public static let two: CGFloat = 16
|
|
public static let three: CGFloat = 24
|
|
public static let four: CGFloat = 32
|
|
public static let five: CGFloat = 40
|
|
public static let six: CGFloat = 48
|
|
}
|
|
|
|
public enum CornerRadius {
|
|
public static var half: CGFloat = 4
|
|
public static var one: CGFloat = 8
|
|
public static var two: CGFloat = 16
|
|
public static var three: CGFloat = 24
|
|
public static var four: CGFloat = 32
|
|
public static var five: CGFloat = 40
|
|
public static var six: CGFloat = 48
|
|
|
|
// Out of system points
|
|
/// 2pt
|
|
public static var micro: CGFloat = 2
|
|
/// 10pt
|
|
public static var oneAndMicro: CGFloat = 10
|
|
/// 12pt
|
|
public static var oneAndHalf: CGFloat = 12
|
|
/// 18pt
|
|
public static var twoAndMicro: CGFloat = 18
|
|
/// 20pt
|
|
public static var twoAndHalf: CGFloat = 20
|
|
}
|
|
|
|
public enum Border {
|
|
public enum Width {
|
|
public static var `default`: CGFloat = 1
|
|
}
|
|
}
|
|
|
|
public enum Button {
|
|
public static let minHeight: CGFloat = 48
|
|
public static let maxWidth: CGFloat = 380
|
|
}
|
|
|
|
public enum List {
|
|
public static let rowMaxWidth: CGFloat = 380
|
|
}
|
|
|
|
public enum Animation {
|
|
public static let `default`: SwiftUICore.Animation = .easeInOut(duration: 0.3)
|
|
public static let easeInOutFaster: SwiftUICore.Animation = .easeInOut(duration: 0.1)
|
|
public static let easeInOutSlower: SwiftUICore.Animation = .easeInOut(duration: 0.8)
|
|
}
|
|
}
|