Skip to content

Commit

Permalink
feat(sdds-components): styles api migration
Browse files Browse the repository at this point in the history
  • Loading branch information
vkaltyrin committed Dec 26, 2024
1 parent 78b5b12 commit 8f7f4d3
Show file tree
Hide file tree
Showing 142 changed files with 4,406 additions and 2,150 deletions.
404 changes: 245 additions & 159 deletions SDDSComponents/SDDSComponents.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,120 +1,20 @@
import Foundation
import SwiftUI
import SDDSComponents
import SDDSServTheme
import SwiftUI

// MARK: - Preview

struct SDDSAvatarPreview: PreviewProvider {
static var previews: some View {
Group {
// Online Status Previews
SDDSAvatar(
text: "JD",
image: nil,
placeholderImage: nil,
status: .online,
appearance: .default,
size: DefaultAvatarSize.extraExtraLarge,
accessibility: defaultAccessibility
)
.previewDisplayName("Online - Text Only")

SDDSAvatar(
text: "",
image: .image(Image.image("checker")),
placeholderImage: nil,
status: .online,
appearance: .default,
size: DefaultAvatarSize.extraExtraLarge,
accessibility: defaultAccessibility
)
.previewDisplayName("Online - Image")

SDDSAvatar(
text: "JD",
image: nil,
placeholderImage: .image(Image.image("checker")),
status: .online,
appearance: .default,
size: DefaultAvatarSize.extraExtraLarge,
accessibility: defaultAccessibility
)
.previewDisplayName("Online - Placeholder with Text")

// Offline Status Previews
SDDSAvatar(
text: "JD",
image: nil,
placeholderImage: nil,
status: .offline,
appearance: .default,
size: DefaultAvatarSize.extraExtraLarge,
accessibility: defaultAccessibility
)
.previewDisplayName("Offline - Text Only")

SDDSAvatar(
text: "",
image: .image(Image.image("checker")),
placeholderImage: nil,
status: .offline,
appearance: .default,
size: DefaultAvatarSize.extraExtraLarge,
accessibility: defaultAccessibility
)
.previewDisplayName("Offline - Image")

SDDSAvatar(
text: "JD",
image: nil,
placeholderImage: .image(Image.image("checker")),
status: .offline,
appearance: .default,
size: DefaultAvatarSize.extraExtraLarge,
accessibility: defaultAccessibility
)
.previewDisplayName("Offline - Placeholder with Text")

// Hidden Status Previews
SDDSAvatar(
text: "JD",
image: nil,
placeholderImage: nil,
status: .hidden,
appearance: .default,
size: DefaultAvatarSize.extraExtraLarge,
accessibility: defaultAccessibility
)
.previewDisplayName("Hidden - Text Only")

SDDSAvatar(
text: "",
image: .image(Image.image("checker")),
placeholderImage: nil,
status: .hidden,
appearance: .default,
size: DefaultAvatarSize.extraExtraLarge,
accessibility: defaultAccessibility
)
.previewDisplayName("Hidden - Image")

SDDSAvatar(
text: "JD",
image: nil,
placeholderImage: .image(Image.image("checker")),
status: .hidden,
appearance: .default,
size: DefaultAvatarSize.extraExtraLarge,
accessibility: defaultAccessibility
)
.previewDisplayName("Hidden - Placeholder with Text")
}
.previewLayout(.sizeThatFits)
.padding()
}

private static var defaultAccessibility: AvatarAccessibility {
AvatarAccessibility(label: "User Avatar", hint: "Displays user status and initials or image")
SDDSAvatar(
text: "",
image: .image(Image.image("checker")),
placeholderImage: nil,
status: .online,
appearance: SDDSAvatar.extraExtraLarge.medium.appearance,
accessibility: AvatarAccessibility()
)
.previewLayout(PreviewLayout.sizeThatFits)
.previewDisplayName("Default")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,23 @@ struct SDDSAvatarGroupPreview: PreviewProvider {
image: nil,
placeholderImage: nil,
status: .online,
appearance: .default,
size: DefaultAvatarSize.extraExtraLarge,
appearance: SDDSAvatar.large.default.appearance,
accessibility: defaultAccessibility
),
SDDSAvatarData(
text: "ML",
image: .image(Image(systemName: "person.fill")),
placeholderImage: nil,
status: .offline,
appearance: .default,
size: DefaultAvatarSize.extraExtraLarge,
appearance: SDDSAvatar.large.default.appearance,
accessibility: defaultAccessibility
),
SDDSAvatarData(
text: "ML",
image: .image(Image(systemName: "person.fill")),
placeholderImage: nil,
status: .offline,
appearance: .default,
size: DefaultAvatarSize.extraExtraLarge,
appearance: SDDSAvatar.large.default.appearance,
accessibility: defaultAccessibility
)
]
Expand All @@ -53,8 +50,7 @@ struct SDDSAvatarGroupPreview: PreviewProvider {
image: nil,
placeholderImage: nil,
status: .hidden,
appearance: .default,
size: DefaultAvatarSize.extraExtraLarge,
appearance: SDDSAvatar.large.default.appearance,
accessibility: defaultAccessibility
)
}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Foundation
import SDDSComponents
import SDDSServTheme
import SwiftUI

// MARK: - Preview
struct SDDSCheckboxPreview: PreviewProvider {
static var previews: some View {
SDDSCheckbox(
state: .constant(.indeterminate),
title: "Valur",
subtitle: "Description",
isEnabled: true,
images: .checkbox,
appearance: SDDSCheckbox.medium.default.appearance
)
.previewLayout(PreviewLayout.sizeThatFits)
.previewDisplayName("Default")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ struct SDDSCheckboxGroupPreview: PreviewProvider {
subtitle: "Parent Description",
isEnabled: true,
images: SelectionControlStateImages.checkbox,
size: SDDSCheckboxSize.medium,
appearance: CheckboxAppearance.default,
appearance: SDDSCheckbox.medium.default.appearance,
accessibility: SelectionControlAccessibility()
)

Expand All @@ -24,8 +23,7 @@ struct SDDSCheckboxGroupPreview: PreviewProvider {
subtitle: "Description \(index + 1)",
isEnabled: true,
images: SelectionControlStateImages.checkbox,
size: SDDSCheckboxSize.medium,
appearance: CheckboxAppearance.default,
appearance: SDDSCheckbox.medium.default.appearance,
accessibility: SelectionControlAccessibility()
)
}
Expand Down
Loading

0 comments on commit 8f7f4d3

Please sign in to comment.