diff --git a/Packages/Account/Sources/Account/AccountDetailHeaderView.swift b/Packages/Account/Sources/Account/AccountDetailHeaderView.swift index 3e91d929..7e16d126 100644 --- a/Packages/Account/Sources/Account/AccountDetailHeaderView.swift +++ b/Packages/Account/Sources/Account/AccountDetailHeaderView.swift @@ -124,7 +124,7 @@ struct AccountDetailHeaderView: View { routeurPath.handle(url: url) }) } - .padding(.horizontal, DS.Constants.layoutPadding) + .padding(.horizontal, .layoutPadding) .offset(y: -40) } diff --git a/Packages/Account/Sources/Account/AccountDetailView.swift b/Packages/Account/Sources/Account/AccountDetailView.swift index eef1b3fb..b2378aec 100644 --- a/Packages/Account/Sources/Account/AccountDetailView.swift +++ b/Packages/Account/Sources/Account/AccountDetailView.swift @@ -50,7 +50,7 @@ public struct AccountDetailView: View { } } .pickerStyle(.segmented) - .padding(.horizontal, DS.Constants.layoutPadding) + .padding(.horizontal, .layoutPadding) .offset(y: -20) } .id("status") @@ -180,7 +180,7 @@ public struct AccountDetailView: View { } } } - .padding(.leading, DS.Constants.layoutPadding) + .padding(.leading, .layoutPadding) } } } @@ -191,7 +191,7 @@ public struct AccountDetailView: View { VStack(alignment: .leading, spacing: 2) { Text("Also followed by") .font(.headline) - .padding(.leading, DS.Constants.layoutPadding) + .padding(.leading, .layoutPadding) ScrollView(.horizontal, showsIndicators: false) { LazyHStack(spacing: 0) { ForEach(viewModel.familliarFollowers) { account in @@ -202,7 +202,7 @@ public struct AccountDetailView: View { .padding(.leading, -4) } } - .padding(.leading, DS.Constants.layoutPadding + 4) + .padding(.leading, .layoutPadding + 4) } } .padding(.top, 2) @@ -244,7 +244,7 @@ public struct AccountDetailView: View { Spacer() Image(systemName: "chevron.right") } - .padding(.horizontal, DS.Constants.layoutPadding) + .padding(.horizontal, .layoutPadding) .padding(.vertical, 8) } } @@ -260,7 +260,7 @@ public struct AccountDetailView: View { Image(systemName: "chevron.right") } .padding(.vertical, 8) - .padding(.horizontal, DS.Constants.layoutPadding) + .padding(.horizontal, .layoutPadding) .font(.headline) .foregroundColor(theme.labelColor) } @@ -275,7 +275,7 @@ public struct AccountDetailView: View { Button("Create a new list") { isCreateListAlertPresented = true } - .padding(.horizontal, DS.Constants.layoutPadding) + .padding(.horizontal, .layoutPadding) } .alert("Create a new list", isPresented: $isCreateListAlertPresented) { TextField("List name", text: $createListTitle) diff --git a/Packages/DesignSystem/Sources/DesignSystem/DesignSystem.swift b/Packages/DesignSystem/Sources/DesignSystem/DesignSystem.swift index 585b6fe0..ef0ba719 100644 --- a/Packages/DesignSystem/Sources/DesignSystem/DesignSystem.swift +++ b/Packages/DesignSystem/Sources/DesignSystem/DesignSystem.swift @@ -1,9 +1,7 @@ import Foundation -public struct DS { - public enum Constants { - public static let layoutPadding: CGFloat = 20 - public static let dividerPadding: CGFloat = 4 - public static let statusColumnsSpacing: CGFloat = 8 - } +extension CGFloat { + public static let layoutPadding: CGFloat = 20 + public static let dividerPadding: CGFloat = 4 + public static let statusColumnsSpacing: CGFloat = 8 } diff --git a/Packages/Notifications/Sources/Notifications/NotificationsListView.swift b/Packages/Notifications/Sources/Notifications/NotificationsListView.swift index aedfa1c8..0e93e107 100644 --- a/Packages/Notifications/Sources/Notifications/NotificationsListView.swift +++ b/Packages/Notifications/Sources/Notifications/NotificationsListView.swift @@ -32,8 +32,8 @@ public struct NotificationsListView: View { .font(.title3) } } - .padding(.horizontal, DS.Constants.layoutPadding) - .padding(.top, DS.Constants.layoutPadding) + .padding(.horizontal, .layoutPadding) + .padding(.top, .layoutPadding) } .background(theme.primaryBackgroundColor) .task { @@ -61,14 +61,14 @@ public struct NotificationsListView: View { .redacted(reason: .placeholder) .shimmering() Divider() - .padding(.vertical, DS.Constants.dividerPadding) + .padding(.vertical, .dividerPadding) } case let .display(notifications, nextPageState): ForEach(notifications) { notification in NotificationRowView(notification: notification) Divider() - .padding(.vertical, DS.Constants.dividerPadding) + .padding(.vertical, .dividerPadding) } switch nextPageState { diff --git a/Packages/Status/Sources/Status/Detail/StatusDetailVIew.swift b/Packages/Status/Sources/Status/Detail/StatusDetailVIew.swift index af399534..6e1d1575 100644 --- a/Packages/Status/Sources/Status/Detail/StatusDetailVIew.swift +++ b/Packages/Status/Sources/Status/Detail/StatusDetailVIew.swift @@ -34,7 +34,7 @@ public struct StatusDetailView: View { ForEach(context.ancestors) { ancestor in StatusRowView(viewModel: .init(status: ancestor, isCompact: false)) Divider() - .padding(.vertical, DS.Constants.dividerPadding) + .padding(.vertical, .dividerPadding) } } StatusRowView(viewModel: .init(status: status, @@ -42,12 +42,12 @@ public struct StatusDetailView: View { isFocused: true)) .id(status.id) Divider() - .padding(.bottom, DS.Constants.dividerPadding * 2) + .padding(.bottom, .dividerPadding * 2) if !context.descendants.isEmpty { ForEach(context.descendants) { descendant in StatusRowView(viewModel: .init(status: descendant, isCompact: false)) Divider() - .padding(.vertical, DS.Constants.dividerPadding) + .padding(.vertical, .dividerPadding) } } @@ -55,8 +55,8 @@ public struct StatusDetailView: View { Text(error.localizedDescription) } } - .padding(.horizontal, DS.Constants.layoutPadding) - .padding(.top, DS.Constants.layoutPadding) + .padding(.horizontal, .layoutPadding) + .padding(.top, .layoutPadding) } .scrollContentBackground(.hidden) .background(theme.primaryBackgroundColor) diff --git a/Packages/Status/Sources/Status/Editor/Components/StatusEditorAccessoryView.swift b/Packages/Status/Sources/Status/Editor/Components/StatusEditorAccessoryView.swift index 03027743..5025c21c 100644 --- a/Packages/Status/Sources/Status/Editor/Components/StatusEditorAccessoryView.swift +++ b/Packages/Status/Sources/Status/Editor/Components/StatusEditorAccessoryView.swift @@ -47,7 +47,7 @@ struct StatusEditorAccessoryView: View { characterCountView } .frame(height: 20) - .padding(.horizontal, DS.Constants.layoutPadding) + .padding(.horizontal, .layoutPadding) .padding(.vertical, 12) .background(.ultraThinMaterial) } diff --git a/Packages/Status/Sources/Status/Editor/Components/StatusEditorAutoCompleteView.swift b/Packages/Status/Sources/Status/Editor/Components/StatusEditorAutoCompleteView.swift index 0168da69..12b5ee2f 100644 --- a/Packages/Status/Sources/Status/Editor/Components/StatusEditorAutoCompleteView.swift +++ b/Packages/Status/Sources/Status/Editor/Components/StatusEditorAutoCompleteView.swift @@ -16,7 +16,7 @@ struct StatusEditorAutoCompleteView: View { suggestionsTagView } } - .padding(.horizontal, DS.Constants.layoutPadding) + .padding(.horizontal, .layoutPadding) } .frame(height: 40) .background(.ultraThinMaterial) diff --git a/Packages/Status/Sources/Status/Editor/Components/StatusEditorMediaView.swift b/Packages/Status/Sources/Status/Editor/Components/StatusEditorMediaView.swift index a8bd36bb..0d5fe2a6 100644 --- a/Packages/Status/Sources/Status/Editor/Components/StatusEditorMediaView.swift +++ b/Packages/Status/Sources/Status/Editor/Components/StatusEditorMediaView.swift @@ -28,7 +28,7 @@ struct StatusEditorMediaView: View { } } } - .padding(.horizontal, DS.Constants.layoutPadding) + .padding(.horizontal, .layoutPadding) } } diff --git a/Packages/Status/Sources/Status/Editor/StatusEditorView.swift b/Packages/Status/Sources/Status/Editor/StatusEditorView.swift index 3c1bbba5..edfd3e04 100644 --- a/Packages/Status/Sources/Status/Editor/StatusEditorView.swift +++ b/Packages/Status/Sources/Status/Editor/StatusEditorView.swift @@ -29,13 +29,13 @@ public struct StatusEditorView: View { spoilerTextView VStack(spacing: 12) { accountHeaderView - .padding(.horizontal, DS.Constants.layoutPadding) + .padding(.horizontal, .layoutPadding) TextView($viewModel.statusText, $viewModel.selectedRange) .placeholder("What's on your mind") - .padding(.horizontal, DS.Constants.layoutPadding) + .padding(.horizontal, .layoutPadding) if let status = viewModel.embededStatus { StatusEmbededView(status: status) - .padding(.horizontal, DS.Constants.layoutPadding) + .padding(.horizontal, .layoutPadding) } StatusEditorMediaView(viewModel: viewModel) Spacer() @@ -95,7 +95,7 @@ public struct StatusEditorView: View { VStack { TextField("Spoiler Text", text: $viewModel.spoilerText) .focused($isSpoilerTextFocused) - .padding(.horizontal, DS.Constants.layoutPadding) + .padding(.horizontal, .layoutPadding) } .frame(height: 35) .background(theme.tintColor.opacity(0.20)) diff --git a/Packages/Status/Sources/Status/List/StatusesListView.swift b/Packages/Status/Sources/Status/List/StatusesListView.swift index f0ef12ea..3043bb89 100644 --- a/Packages/Status/Sources/Status/List/StatusesListView.swift +++ b/Packages/Status/Sources/Status/List/StatusesListView.swift @@ -19,7 +19,7 @@ public struct StatusesListView: View where Fetcher: StatusesFetcher { .redacted(reason: .placeholder) .shimmering() Divider() - .padding(.vertical, DS.Constants.dividerPadding) + .padding(.vertical, .dividerPadding) } case let .error(error): Text(error.localizedDescription) @@ -27,7 +27,7 @@ public struct StatusesListView: View where Fetcher: StatusesFetcher { ForEach(statuses, id: \.viewId) { status in StatusRowView(viewModel: .init(status: status, isCompact: false)) Divider() - .padding(.vertical, DS.Constants.dividerPadding) + .padding(.vertical, .dividerPadding) } switch nextPageState { @@ -45,7 +45,7 @@ public struct StatusesListView: View where Fetcher: StatusesFetcher { } } } - .padding(.horizontal, DS.Constants.layoutPadding) + .padding(.horizontal, .layoutPadding) } private var loadingRow: some View { diff --git a/Packages/Status/Sources/Status/Row/StatusMediaPreviewView.swift b/Packages/Status/Sources/Status/Row/StatusMediaPreviewView.swift index 8e29dd00..b4d9ef4b 100644 --- a/Packages/Status/Sources/Status/Row/StatusMediaPreviewView.swift +++ b/Packages/Status/Sources/Status/Row/StatusMediaPreviewView.swift @@ -96,8 +96,8 @@ public struct StatusMediaPreviewView: View { switch attachement.supportedType { case .image: if let size = size(for: attachement) { - let avatarColumnWidth = theme.avatarPosition == .leading ? AvatarView.Size.status.size.width + DS.Constants.statusColumnsSpacing : 0 - let availableWidth = UIScreen.main.bounds.width - (DS.Constants.layoutPadding * 2) - avatarColumnWidth + let avatarColumnWidth = theme.avatarPosition == .leading ? AvatarView.Size.status.size.width + .statusColumnsSpacing : 0 + let availableWidth = UIScreen.main.bounds.width - (.layoutPadding * 2) - avatarColumnWidth let newSize = imageSize(from: size, newWidth: availableWidth) LazyImage(url: attachement.url) { state in diff --git a/Packages/Status/Sources/Status/Row/StatusRowView.swift b/Packages/Status/Sources/Status/Row/StatusRowView.swift index 65a5ad6c..1585f739 100644 --- a/Packages/Status/Sources/Status/Row/StatusRowView.swift +++ b/Packages/Status/Sources/Status/Row/StatusRowView.swift @@ -18,7 +18,7 @@ public struct StatusRowView: View { } public var body: some View { - HStack(alignment: .top, spacing: DS.Constants.statusColumnsSpacing) { + HStack(alignment: .top, spacing: .statusColumnsSpacing) { if !viewModel.isCompact, theme.avatarPosition == .leading, let status: AnyStatus = viewModel.status.reblog ?? viewModel.status { diff --git a/Packages/Timeline/Sources/Timeline/TimelineView.swift b/Packages/Timeline/Sources/Timeline/TimelineView.swift index d23123e3..0aa98521 100644 --- a/Packages/Timeline/Sources/Timeline/TimelineView.swift +++ b/Packages/Timeline/Sources/Timeline/TimelineView.swift @@ -43,7 +43,7 @@ public struct TimelineView: View { .padding(.bottom, 16) StatusesListView(fetcher: viewModel) } - .padding(.top, DS.Constants.layoutPadding) + .padding(.top, .layoutPadding) } .background(theme.primaryBackgroundColor) if viewModel.pendingStatusesEnabled { @@ -148,7 +148,7 @@ public struct TimelineView: View { Text(tag.following ? "Following": "Follow") }.buttonStyle(.bordered) } - .padding(.horizontal, DS.Constants.layoutPadding) + .padding(.horizontal, .layoutPadding) .padding(.vertical, 8) .background(theme.secondaryBackgroundColor) }