Skip to content
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

feat(sdds-counter): added sdds-counter #137

Conversation

VladimirDimitraki
Copy link
Collaborator

No description provided.

Copy link
Collaborator

@vkaltyrin vkaltyrin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}
.background(currentColor(for: appearance.backgroundColor))
.cornerRadius(cornerRadius)
.frame(maxWidth: data.value.count > 1 ? .infinity : appearance.size.width, minHeight: appearance.size.height)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VladimirDimitraki Давай вот эту штуку data.value.count > 1 ? .infinity : appearance.size.width вынесем в отдельный computed property

if let typography = appearance.dataTypography.typography(with: appearance.size) {
return typography
} else {
fatalError("Undefined Button Typography for size \(appearance.size.debugDescription). Using a default value.")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Undefined Counter Typography for size \(appearance.size.debugDescription). Using a default value."

Можно кстати вынести всю эту строку в отдельную функцию в extension для View, вроде

extension View {
    func undefinedTypographyErrorText(sizeDescription: String) -> String {
        "Undefined \(Self.self) Typography for size \(sizeDescription). Using a default value."
    }
}

и вызвать

fatalError(undefinedTypographyErrorText(sizeDescription: appearance.size.debugDescription))

public var body: some View {
List {
counterView

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VladimirDimitraki Давай уберем переход на новую строку


Section {
dataTextField

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не нужен переход на новую строку

dataTextField

appearance

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не нужен переход на новую строку


public var body: some View {
ZStack {
if data.value.count > 1 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VladimirDimitraki data.value.count > 1 вот эту штуку лучше вынести в computer property и назвать например var isAuto: Bool

}

public var counterAutomationSize: some View {
Text("\(data.value)")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VladimirDimitraki "\(data.value)" вот эту штуку можно вынести в computer property var text: String и переиспользовать везде

Copy link
Collaborator

@vkaltyrin vkaltyrin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Выглядит хорошо 👍 Есть несколько минорных комментов

@@ -16,4 +16,8 @@ public extension View {
func gradient(_ token: GradientToken, colorScheme: ColorScheme = .light) -> some View {
modifier(GradientModifier(token: token, colorScheme: colorScheme))
}

func undefinedTypographyErrorText(sizeDescription: String) -> String {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VladimirDimitraki Давай лучше заведем extension именно в SDDSComponents, поскольку этот метод будет использоваться только там. Тем более – именно этот extension (SDDSThemeBuilder/SDDSThemeCore/Sources/SDDSThemeCore/Extensions/View+Tokens.swift) используется только модификаторов токенов, а не для функций-утилит

}

var dynamicWidth: CGFloat {
data.value.count > 1 ? .infinity : appearance.size.width
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VladimirDimitraki здесь можно использовать isAuto

@VladimirDimitraki VladimirDimitraki force-pushed the feature/vsdimitraki/components-counter branch from 9f364cb to 6fef021 Compare December 27, 2024 09:40
@VladimirDimitraki VladimirDimitraki force-pushed the feature/vsdimitraki/components-counter branch from c7a39ff to 8377aa6 Compare January 9, 2025 06:30
@VladimirDimitraki VladimirDimitraki force-pushed the feature/vsdimitraki/components-counter branch from 8377aa6 to 85c6e7c Compare January 13, 2025 09:43
@vkaltyrin vkaltyrin closed this Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants