Skip to content

Commit

Permalink
Works
Browse files Browse the repository at this point in the history
  • Loading branch information
kugel3 committed Aug 17, 2023
1 parent 731ca5e commit b0ecb93
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions Sources/Core/DesignSystem/Components/Thumbnails.swift
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ public struct LoadableImage<Placeholder: View>: View {
case let .asset(imageAsset):
Image(asset: imageAsset)
.resizable()
.frame(width: brokenImageSize.width, height: brokenImageSize.height)
case .brokenImage:
HStack(spacing: 0) {
Spacer(minLength: .small1)
Expand All @@ -241,10 +242,20 @@ public struct LoadableImage<Placeholder: View>: View {

Spacer(minLength: .small1)
}
.frame(height: .imagePlaceholderHeight)
.frame(width: brokenImageSize.width, height: brokenImageSize.height)
.background(.app.gray4)
case .standard:
placeholder
.frame(width: brokenImageSize.width, height: brokenImageSize.height)
}
}

private var brokenImageSize: (width: CGFloat?, height: CGFloat) {
switch sizingBehaviour {
case let .fixedSize(size, _):
return (size.frame.width, size.frame.height)
case .flexible:
return (nil, .imagePlaceholderHeight)
}
}
}
Expand All @@ -253,11 +264,6 @@ public struct LoadableImage<Placeholder: View>: View {
public enum LoadableImageSize: Equatable {
case fixedSize(HitTargetSize, mode: ImageResizingMode = .aspectFill)
case flexible(minAspect: CGFloat, maxAspect: CGFloat)

var isFixedSize: Bool {
if case .fixedSize = self { return true }
return false
}
}

// MARK: - LoadableImagePlaceholderBehaviour
Expand Down

0 comments on commit b0ecb93

Please sign in to comment.