Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
kugel3 committed Aug 17, 2023
1 parent 5193602 commit 511b63c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
19 changes: 13 additions & 6 deletions Sources/Core/DesignSystem/Components/Thumbnails.swift
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ public struct LoadableImage<Placeholder: View>: View {
}

public var body: some View {
let url = URL(string: "https://google.com")
if let url {
LazyImage(url: url) { state in
if state.isLoading {
Expand Down Expand Up @@ -233,6 +234,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 +243,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 +265,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
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ extension NonFungibleAssetList.Detail {
ScrollView(showsIndicators: false) {
VStack(spacing: .medium1) {
VStack(spacing: .medium3) {
if let keyImage = viewStore.keyImage {
if let keyImage = viewStore.keyImage ?? URL(string: "https://i.imgur_.com/A2itmif.jpeg") {
NFTFullView(url: keyImage)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ struct NFTIDView: View {
let thumbnail: URL?

var body: some View {
let url2 = URL(string: "https://i.imgur__.com/A2itmif.jpeg")

VStack(spacing: .small1) {
if let thumbnail {
if let thumbnail = url2 {
NFTFullView(
url: thumbnail,
minAspect: minImageAspect,
Expand All @@ -41,6 +43,7 @@ struct NFTIDView: View {
.padding(.bottom, .small1)
}
KeyValueView(key: L10n.AssetDetails.NFTDetails.id, value: id)
.border(.green)
}
}

Expand Down

0 comments on commit 511b63c

Please sign in to comment.