Skip to content

Небольшое обновление #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/OlegEremenko991/CachedAsyncImage991",
"state" : {
"revision" : "db996671b7b0cc3466f3a6b867bed02baeb7f428",
"version" : "1.0.8"
"revision" : "e308c3519417eba297c26b1d7c41eae20ccbf0e1",
"version" : "1.1.0"
}
}
],
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let package = Package(
.library(name: "SWDesignSystem", targets: ["SWDesignSystem"])
],
dependencies: [
.package(url: "https://github.com/OlegEremenko991/CachedAsyncImage991", from: "1.0.8")
.package(url: "https://github.com/OlegEremenko991/CachedAsyncImage991", from: "1.1.0")
],
targets: [
.target(
Expand Down
9 changes: 2 additions & 7 deletions Sources/SWDesignSystem/Internal/CardBackgroundModifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,7 @@ struct CardBackgroundModifier: ViewModifier {

#if DEBUG
#Preview {
VStack(spacing: 16) {
Text("Light mode text")
.insideCardBackground()
Text("Dark mode text")
.insideCardBackground()
.environment(\.colorScheme, .dark)
}
Text("Текст для превью")
.insideCardBackground()
}
#endif
1 change: 0 additions & 1 deletion Sources/SWDesignSystem/Internal/DefaultWorkoutImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@ struct DefaultWorkoutImage: View {
DefaultWorkoutImage(size: .init(width: 45, height: 45))
DefaultWorkoutImage(size: .init(width: 60, height: 60))
}
.padding()
}
#endif
8 changes: 1 addition & 7 deletions Sources/SWDesignSystem/Public/Color+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,9 @@ public extension Color {
return ScrollView {
VStack(spacing: 4) {
ForEach(colors, id: \.self) { color in
HStack(spacing: 20) {
Group {
Circle()
Circle()
.environment(\.colorScheme, .dark)
}
Circle()
.foregroundStyle(color)
.frame(width: 50, height: 50)
}
}
}
.frame(maxWidth: .infinity)
Expand Down
2 changes: 1 addition & 1 deletion Sources/SWDesignSystem/Public/Rows/CheckmarkRowView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public struct TextWithCheckmarkRowView: View {
#Preview {
TextWithCheckmarkRowView(text: "Checked text", isChecked: true)
.insideCardBackground(padding: 0)
.padding()
.padding(.horizontal)
}
#endif
2 changes: 0 additions & 2 deletions Sources/SWDesignSystem/Public/Rows/CommentRowView.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import CachedAsyncImage991
import SwiftUI

/// Вьюшка с комментарием (в списке комментариев)
Expand Down Expand Up @@ -118,6 +117,5 @@ private extension CommentRowView {
editAction: {},
deleteAction: {}
)
.padding()
}
#endif
2 changes: 1 addition & 1 deletion Sources/SWDesignSystem/Public/Rows/DialogRowView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,6 @@ private extension DialogRowView {
unreadCount: 3
)
)
.padding()
.padding(.horizontal)
}
#endif
24 changes: 7 additions & 17 deletions Sources/SWDesignSystem/Public/Rows/EventRowView.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import CachedAsyncImage991
import SwiftUI

/// Вьюшка с мероприятием (в списке мероприятий)
Expand Down Expand Up @@ -74,21 +73,12 @@ private extension EventRowView {

#if DEBUG
#Preview {
VStack(spacing: 30) {
EventRowView(
imageURL: nil,
title: "Открытая воскресная тренировка #3 в 2023 году (участники)",
dateTimeText: "22 янв, 12:00",
locationText: "Россия, Москва"
)
EventRowView(
imageURL: nil,
title: "Открытая воскресная тренировка #3 в 2023 году (участники)",
dateTimeText: "22 янв, 12:00",
locationText: "Россия, Москва"
)
.environment(\.colorScheme, .dark)
}
.padding()
EventRowView(
imageURL: nil,
title: "Открытая воскресная тренировка #3 в 2023 году (участники)",
dateTimeText: "22 янв, 12:00",
locationText: "Россия, Москва"
)
.padding(.horizontal)
}
#endif
19 changes: 6 additions & 13 deletions Sources/SWDesignSystem/Public/Rows/FormRowView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,12 @@ public extension FormRowView {

#if DEBUG
#Preview {
Group {
ForEach(ColorScheme.allCases, id: \.self) { scheme in
VStack(spacing: 20) {
FormRowView(title: "Друзья", trailingContent: .textWithChevron("56 друзей"))
FormRowView(title: "Друзья", trailingContent: .textWithBadgeAndChevron("56 друзей", 5))
FormRowView(title: "Где тренируется", trailingContent: .textWithChevron("26 площадок"))
FormRowView(title: "Тренируюсь здесь", trailingContent: .toggle(.constant(true)))
}
.padding()
.background(Color.swBackground)
.environment(\.colorScheme, scheme)
.previewDisplayName(scheme == .dark ? "Dark" : "Light")
}
VStack(spacing: 20) {
FormRowView(title: "Друзья", trailingContent: .textWithChevron("56 друзей"))
FormRowView(title: "Друзья", trailingContent: .textWithBadgeAndChevron("56 друзей", 5))
FormRowView(title: "Где тренируется", trailingContent: .textWithChevron("26 площадок"))
FormRowView(title: "Тренируюсь здесь", trailingContent: .toggle(.constant(true)))
}
.padding(.horizontal)
}
#endif
30 changes: 9 additions & 21 deletions Sources/SWDesignSystem/Public/Rows/JournalRowView.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import CachedAsyncImage991
import SwiftUI

/// Вьюшка для записи в дневнике
Expand Down Expand Up @@ -150,26 +149,15 @@ private extension JournalRowView {

#if DEBUG
#Preview {
VStack(spacing: 30) {
JournalRowView(
model: .init(
avatarURL: .init(string: "https://workout.su/uploads/avatars/2019/10/2019-10-07-01-10-08-yow.jpg")!,
title: "Дневник 1",
dateText: "21 мая 2023",
bodyText: "Классная площадка, часто тренируюсь здесь с друзьями. Сегодня тренировался на стадионе. Для начала небольшая пробежка для разминки",
bodyTextLinelimit: 2
)
JournalRowView(
model: .init(
avatarURL: .init(string: "https://workout.su/uploads/avatars/2019/10/2019-10-07-01-10-08-yow.jpg")!,
title: "Дневник 1",
dateText: "21 мая 2023",
bodyText: "Классная площадка, часто тренируюсь здесь с друзьями. Сегодня тренировался на стадионе. Для начала небольшая пробежка для разминки",
bodyTextLinelimit: 2
)
JournalRowView(
model: .init(
avatarURL: .init(string: "https://workout.su/uploads/avatars/2019/10/2019-10-07-01-10-08-yow.jpg")!,
title: "Kahar",
dateText: "21 мая 2023",
bodyText: "Классная площадка, часто тренируюсь здесь с друзьями. Сегодня тренировался на стадионе. Для начала небольшая пробежка для разминки"
)
)
.environment(\.colorScheme, .dark)
}
.padding()
)
.padding(.horizontal)
}
#endif
2 changes: 1 addition & 1 deletion Sources/SWDesignSystem/Public/Rows/ListRowView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,6 @@ public extension ListRowView {
ListRowView(leadingContent: model.left, trailingContent: model.right)
}
}
.padding()
.padding(.horizontal)
}
#endif
48 changes: 20 additions & 28 deletions Sources/SWDesignSystem/Public/Rows/ParkRowView.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import CachedAsyncImage991
import SwiftUI

/// Вьюшка с площадкой (в списке площадок)
Expand Down Expand Up @@ -76,33 +75,26 @@ private extension ParkRowView {

#if DEBUG
#Preview {
Group {
ForEach(ColorScheme.allCases, id: \.self) { scheme in
VStack(spacing: 12) {
ParkRowView(
imageURL: URL(string: "https://workout.su/uploads/userfiles/измайлово.jpg"),
title: "N° 3 Легендарная / Средняя",
address: "м. Партизанская, улица 2-я Советская",
usersTrainHereText: "Тренируются 5 человек"
)
ParkRowView(
imageURL: URL(string: "https://workout.su/uploads/userfiles/измайлово.jpg"),
title: "N° 3 Легендарная / Средняя",
address: nil,
usersTrainHereText: "Тренируются 5 человек"
)
ParkRowView(
imageURL: URL(string: "https://workout.su/uploads/userfiles/измайлово.jpg"),
title: "N° 3 Легендарная / Средняя",
address: "м. Партизанская, улица 2-я Советская",
usersTrainHereText: "Здесь пока никто не тренируется"
)
}
.padding()
.background(Color.swBackground)
.environment(\.colorScheme, scheme)
.previewDisplayName(scheme == .dark ? "Dark" : "Light")
}
VStack(spacing: 12) {
ParkRowView(
imageURL: URL(string: "https://workout.su/uploads/userfiles/измайлово.jpg"),
title: "N° 3 Легендарная / Средняя",
address: "м. Партизанская, улица 2-я Советская",
usersTrainHereText: "Тренируются 5 человек"
)
ParkRowView(
imageURL: URL(string: "https://workout.su/uploads/userfiles/измайлово.jpg"),
title: "N° 3 Легендарная / Средняя",
address: nil,
usersTrainHereText: "Тренируются 5 человек"
)
ParkRowView(
imageURL: URL(string: "https://workout.su/uploads/userfiles/измайлово.jpg"),
title: "N° 3 Легендарная / Средняя",
address: "м. Партизанская, улица 2-я Советская",
usersTrainHereText: "Здесь пока никто не тренируется"
)
}
.padding(.horizontal)
}
#endif
23 changes: 8 additions & 15 deletions Sources/SWDesignSystem/Public/Rows/UserRowView.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import CachedAsyncImage991
import SwiftUI

/// Вьюшка для краткой информации о пользователе
Expand Down Expand Up @@ -130,24 +129,18 @@ private extension UserRowView {

#if DEBUG
#Preview {
let baseModel: UserRowView.Mode.BaseModel = .init(
let baseModel = UserRowView.Mode.BaseModel(
imageURL: .init(string: "https://workout.su/uploads/avatars/2019/10/2019-10-07-01-10-08-yow.jpg")!,
name: "Beautifulbutterfly101",
address: "Россия, Краснодар"
)
return Group {
ForEach(ColorScheme.allCases, id: \.self) { scheme in
VStack(spacing: 20) {
UserRowView(mode: .regular(baseModel))
UserRowView(
mode: .friendRequest(baseModel, .init(accept: {}, reject: {}))
)
.insideCardBackground(padding: 0)
}
.environment(\.colorScheme, scheme)
.previewDisplayName(scheme == .dark ? "Dark" : "Light")
}
return VStack(spacing: 20) {
UserRowView(mode: .regular(baseModel))
UserRowView(
mode: .friendRequest(baseModel, .init(accept: {}, reject: {}))
)
.insideCardBackground(padding: 0)
}
.padding()
.padding(.horizontal)
}
#endif
4 changes: 2 additions & 2 deletions Sources/SWDesignSystem/Public/SWTextEditor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private extension SWTextEditor {
.scrollContentBackground(.hidden)
} else {
TextEditor(text: $text)
.accentColor(.swAccent)
.tint(.swAccent)
}
}
}
Expand Down Expand Up @@ -89,6 +89,6 @@ private extension SWTextEditor {
height: 100
)
}
.padding()
.padding(.horizontal)
}
#endif
15 changes: 3 additions & 12 deletions Sources/SWDesignSystem/Public/SWTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public struct SWTextField: View {

public var body: some View {
VStack(alignment: .leading, spacing: 6) {
textFieldView
textField
.tint(.swAccent)
.foregroundStyle(Color.swMainText)
.padding(12)
.background {
Expand Down Expand Up @@ -61,15 +62,6 @@ public extension SWTextField {
}

private extension SWTextField {
@ViewBuilder
var textFieldView: some View {
if #available(iOS 16.0, *) {
textField.tint(.swAccent)
} else {
textField.accentColor(.swAccent)
}
}

@ViewBuilder
var textField: some View {
if isSecure {
Expand Down Expand Up @@ -127,7 +119,6 @@ private extension SWTextField {
errorState: .message("Error message")
)
}
.padding()
.previewLayout(.sizeThatFits)
.padding(.horizontal)
}
#endif
22 changes: 15 additions & 7 deletions Sources/SWDesignSystem/Public/SWTextFieldSearchButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,20 @@ public struct SWTextFieldSearchButton: View {

#if DEBUG
#Preview {
SWTextFieldSearchButton(
"Найти город",
showClearButton: true,
mainAction: { print("main action!") },
clearAction: { print("clear action")}
)
.padding()
VStack(spacing: 16) {
SWTextFieldSearchButton(
"Найти город",
showClearButton: false,
mainAction: { print("main action!") },
clearAction: {}
)
SWTextFieldSearchButton(
"Красноярск",
showClearButton: true,
mainAction: { print("main action!") },
clearAction: { print("clear action") }
)
}
.padding(.horizontal)
}
#endif