Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,11 @@ public struct ConnectionProposalViewModel {
[
ListItemModel(
title: Localized.WalletConnect.Permissions.viewBalance,
imageStyle: .accessory(assetImage: .image(Images.System.checkmark))
imageStyle: .accessory(assetImage: .image(Images.System.checkmark), fontWeight: .semibold)
),
ListItemModel(
title: Localized.WalletConnect.Permissions.approvalRequests,
imageStyle: .accessory(assetImage: .image(Images.System.checkmark))
),
ListItemModel(
title: Localized.WalletConnect.Permissions.moveFunds,
titleStyle: TextStyle(font: .body, color: Colors.secondaryText),
imageStyle: .accessory(assetImage: .image(Images.System.xmark), foregroundColor: Colors.gray)
imageStyle: .accessory(assetImage: .image(Images.System.checkmark), fontWeight: .semibold)
),
]
}
Expand Down
8 changes: 7 additions & 1 deletion Packages/Components/Sources/AssetImageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public struct AssetImageView: View {
)
.frame(width: size, height: size)
.cornerRadius(cornerRadius)
.ifLet(style?.fontWeight) { view, weight in
view.fontWeight(weight)
}
.ifLet(style?.foregroundColor) { view, color in
view.foregroundStyle(color)
}
Expand Down Expand Up @@ -110,13 +113,16 @@ extension AssetImageView {
public struct Style: Sendable, Equatable {
public let foregroundColor: Color?
public let cornerRadius: CGFloat?
public let fontWeight: Font.Weight?

public init(
foregroundColor: Color? = nil,
cornerRadius: CGFloat? = nil
cornerRadius: CGFloat? = nil,
fontWeight: Font.Weight? = nil
) {
self.foregroundColor = foregroundColor
self.cornerRadius = cornerRadius
self.fontWeight = fontWeight
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Packages/Components/Sources/Lists/ListItemView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public struct ListItemView: View {
AssetImageView(
assetImage: imageStyle.assetImage,
size: imageStyle.imageSize,
style: .init(foregroundColor: imageStyle.foregroundColor, cornerRadius: imageStyle.cornerRadius)
style: .init(foregroundColor: imageStyle.foregroundColor, cornerRadius: imageStyle.cornerRadius, fontWeight: imageStyle.fontWeight)
)
}
HStack {
Expand Down
6 changes: 5 additions & 1 deletion Packages/Components/Sources/Types/ListItemImageStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public struct ListItemImageStyle: Sendable {
public let imageSize: CGFloat
public let alignment: VerticalAlignment
public let foregroundColor: Color?
public let fontWeight: Font.Weight?
private let cornerRadiusType: CornerRadiusType

public var cornerRadius: CGFloat {
Expand All @@ -24,6 +25,7 @@ public struct ListItemImageStyle: Sendable {
imageSize: CGFloat,
alignment: VerticalAlignment = .center,
foregroundColor: Color? = nil,
fontWeight: Font.Weight? = nil,
cornerRadiusType: CornerRadiusType
) {
guard let assetImage else { return nil }
Expand All @@ -32,6 +34,7 @@ public struct ListItemImageStyle: Sendable {
self.cornerRadiusType = cornerRadiusType
self.alignment = alignment
self.foregroundColor = foregroundColor
self.fontWeight = fontWeight
}

public enum CornerRadiusType: Sendable {
Expand All @@ -58,11 +61,12 @@ public extension ListItemImageStyle {
)
}

static func accessory(assetImage: AssetImage?, foregroundColor: Color? = nil) -> Self? {
static func accessory(assetImage: AssetImage?, foregroundColor: Color? = nil, fontWeight: Font.Weight? = nil) -> Self? {
ListItemImageStyle(
assetImage: assetImage,
imageSize: .space12,
foregroundColor: foregroundColor,
fontWeight: fontWeight,
cornerRadiusType: .none
)
}
Expand Down
Loading