mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Update files following swiftformat upgrade
This commit is contained in:
committed by
Stefan Ceriu
parent
fe189fcfed
commit
23062901c0
@@ -20,7 +20,9 @@ public struct SendButton: View {
|
||||
return colorScheme == .light ? .compound.iconOnSolidPrimary : .compound.iconPrimary
|
||||
}
|
||||
|
||||
private var gradient: Gradient { isEnabled ? .compound.action : .init(colors: [.clear]) }
|
||||
private var gradient: Gradient {
|
||||
isEnabled ? .compound.action : .init(colors: [.clear])
|
||||
}
|
||||
|
||||
/// Creates a send button that performs the provided action.
|
||||
public init(action: @escaping () -> Void) {
|
||||
|
||||
@@ -16,7 +16,9 @@ public extension Color {
|
||||
|
||||
public extension ShapeStyle where Self == Color {
|
||||
/// The colours used by Element as defined in Compound Design Tokens.
|
||||
static var compound: CompoundColors { Self.compound }
|
||||
static var compound: CompoundColors {
|
||||
Self.compound
|
||||
}
|
||||
}
|
||||
|
||||
/// The colours used by Element as defined in Compound Design Tokens.
|
||||
@@ -100,7 +102,9 @@ public class CompoundColors {
|
||||
|
||||
private extension UITraitCollection {
|
||||
/// Whether or not the trait collection contains a `userInterfaceStyle` of `.light`.
|
||||
var isLight: Bool { userInterfaceStyle == .light }
|
||||
var isLight: Bool {
|
||||
userInterfaceStyle == .light
|
||||
}
|
||||
}
|
||||
|
||||
public struct DecorativeColor: Equatable {
|
||||
|
||||
@@ -17,22 +17,30 @@ public extension Gradient {
|
||||
/// The gradients used by Element as defined in Compound Design Tokens.
|
||||
/// This struct only contains the gradients assembled from the individual colour stops.
|
||||
public struct CompoundGradients {
|
||||
// We need to use computed properties here so that the gradients include the
|
||||
// latest token overrides that have been applied since the struct was created.
|
||||
public var action: Gradient { .init(colors: [.compound.gradientActionStop1,
|
||||
.compound.gradientActionStop2,
|
||||
.compound.gradientActionStop3,
|
||||
.compound.gradientActionStop4]) }
|
||||
public var subtle: Gradient { .init(colors: [.compound.gradientSubtleStop1,
|
||||
.compound.gradientSubtleStop2,
|
||||
.compound.gradientSubtleStop3,
|
||||
.compound.gradientSubtleStop4,
|
||||
.compound.gradientSubtleStop5,
|
||||
.compound.gradientSubtleStop6]) }
|
||||
public var info: Gradient { .init(colors: [.compound.gradientInfoStop1,
|
||||
.compound.gradientInfoStop2,
|
||||
.compound.gradientInfoStop3,
|
||||
.compound.gradientInfoStop4,
|
||||
.compound.gradientInfoStop5,
|
||||
.compound.gradientInfoStop6]) }
|
||||
/// We need to use computed properties here so that the gradients include the
|
||||
/// latest token overrides that have been applied since the struct was created.
|
||||
public var action: Gradient {
|
||||
.init(colors: [.compound.gradientActionStop1,
|
||||
.compound.gradientActionStop2,
|
||||
.compound.gradientActionStop3,
|
||||
.compound.gradientActionStop4])
|
||||
}
|
||||
|
||||
public var subtle: Gradient {
|
||||
.init(colors: [.compound.gradientSubtleStop1,
|
||||
.compound.gradientSubtleStop2,
|
||||
.compound.gradientSubtleStop3,
|
||||
.compound.gradientSubtleStop4,
|
||||
.compound.gradientSubtleStop5,
|
||||
.compound.gradientSubtleStop6])
|
||||
}
|
||||
|
||||
public var info: Gradient {
|
||||
.init(colors: [.compound.gradientInfoStop1,
|
||||
.compound.gradientInfoStop2,
|
||||
.compound.gradientInfoStop3,
|
||||
.compound.gradientInfoStop4,
|
||||
.compound.gradientInfoStop5,
|
||||
.compound.gradientInfoStop6])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,5 +53,7 @@ public class CompoundUIColors {
|
||||
|
||||
private extension UITraitCollection {
|
||||
/// Whether or not the trait collection contains a `userInterfaceStyle` of `.light`.
|
||||
var isLight: Bool { userInterfaceStyle == .light }
|
||||
var isLight: Bool {
|
||||
userInterfaceStyle == .light
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,9 @@ struct ListInlinePicker<SelectedValue: Hashable>: View {
|
||||
// MARK: - Previews
|
||||
|
||||
struct ListInlinePicker_Previews: PreviewProvider, TestablePreview {
|
||||
static var previews: some View { Preview() }
|
||||
static var previews: some View {
|
||||
Preview()
|
||||
}
|
||||
|
||||
struct Preview: View {
|
||||
@State var selection = "Item 1"
|
||||
|
||||
@@ -154,7 +154,7 @@ public struct ListRow<Icon: View, DetailsIcon: View, CustomContent: View, Select
|
||||
|
||||
// MARK: - Initialisers
|
||||
|
||||
// Normal row with a details icon
|
||||
/// Normal row with a details icon
|
||||
public extension ListRow where CustomContent == EmptyView {
|
||||
init(label: ListRowLabel<Icon>,
|
||||
details: ListRowDetails<DetailsIcon>? = nil,
|
||||
@@ -173,7 +173,7 @@ public extension ListRow where CustomContent == EmptyView {
|
||||
}
|
||||
}
|
||||
|
||||
// Normal row without a details icon.
|
||||
/// Normal row without a details icon.
|
||||
public extension ListRow where DetailsIcon == EmptyView, CustomContent == EmptyView {
|
||||
init(label: ListRowLabel<Icon>,
|
||||
details: ListRowDetails<DetailsIcon>? = nil,
|
||||
@@ -192,7 +192,7 @@ public extension ListRow where DetailsIcon == EmptyView, CustomContent == EmptyV
|
||||
}
|
||||
}
|
||||
|
||||
// Custom row without a label or details label.
|
||||
/// Custom row without a label or details label.
|
||||
public extension ListRow where Icon == EmptyView, DetailsIcon == EmptyView {
|
||||
init(kind: Kind<CustomContent, SelectionValue>) {
|
||||
label = ListRowLabel()
|
||||
@@ -449,7 +449,7 @@ public struct ListRow_Previews: PreviewProvider, TestablePreview {
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder static var othersSection: some View {
|
||||
static var othersSection: some View {
|
||||
Section {
|
||||
ListRow(kind: .custom {
|
||||
Text("This is a custom row")
|
||||
|
||||
@@ -52,7 +52,10 @@ public struct ListRowAccessory: View {
|
||||
let kind: Kind
|
||||
|
||||
/// Negative padding added to prevent the accessory interfering with the row's padding.
|
||||
private var verticalPaddingFix: CGFloat { -4 }
|
||||
private var verticalPaddingFix: CGFloat {
|
||||
-4
|
||||
}
|
||||
|
||||
/// Absolute bodge until we have the circle icon in Compound.
|
||||
@ScaledMetric private var circleOverlayInsets = 5
|
||||
|
||||
|
||||
@@ -79,7 +79,9 @@ public struct ListRowLabel<Icon: View>: View {
|
||||
return role == .destructive ? .compound.textCriticalPrimary : .compound.textPrimary
|
||||
}
|
||||
|
||||
var titleLineLimit: Int? { layout == .avatar ? 1 : lineLimit }
|
||||
var titleLineLimit: Int? {
|
||||
layout == .avatar ? 1 : lineLimit
|
||||
}
|
||||
|
||||
var statusColor: Color {
|
||||
isEnabled ? .compound.textSecondary : .compound.textDisabled
|
||||
|
||||
@@ -38,7 +38,9 @@ public struct ListRowTrailingSection<Icon: View>: View {
|
||||
private var accessory: ListRowAccessory?
|
||||
|
||||
@ScaledMetric private var iconSize = 24
|
||||
private var hideAccessory: Bool { isWaiting && accessory?.kind == .unselected }
|
||||
private var hideAccessory: Bool {
|
||||
isWaiting && accessory?.kind == .unselected
|
||||
}
|
||||
|
||||
init(_ details: ListRowDetails<Icon>?, accessory: ListRowAccessory? = nil) {
|
||||
title = details?.title
|
||||
|
||||
@@ -12,7 +12,6 @@ public extension View {
|
||||
/// Styles a search bar text field using the Compound design tokens.
|
||||
/// This modifier is to be used in combination with `.searchable`.
|
||||
@MainActor
|
||||
@ViewBuilder
|
||||
func compoundSearchField() -> some View {
|
||||
introspect(.navigationStack, on: .supportedVersions, scope: .ancestor) { navigationController in
|
||||
// Uses the navigation stack as .searchField is unreliable when pushing the second search bar, during the create rooms flow.
|
||||
|
||||
Reference in New Issue
Block a user