Skip to content

Commit

Permalink
Fix triple avatar cell vertical alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
alpavanoglu committed Feb 14, 2024
1 parent 2b1626e commit 0ee88c7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ final class NotificationsTableHeaderView: UITableViewHeaderFooterView {
static let textColor = UIColor.DS.Foreground.primary ?? .text
static let textFont = UIFont.DS.font(.bodyLarge(.emphasized))
static let layoutMargins = NSDirectionalEdgeInsets(
top: Length.Padding.single,
top: Length.Padding.double,
leading: Length.Padding.double,
bottom: Length.Padding.double,
trailing: Length.Padding.double
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ struct AvatarsView: View {
return Length.Padding.split/2
}
}

var verticalOffset: CGFloat {
switch self {
case .single, .double:
return 0
case .triple:
return Length.Padding.large/2
}
}
}

private let style: Style
Expand Down Expand Up @@ -92,7 +101,6 @@ struct AvatarsView: View {
.avatarBorderOverlay()
}
}
.frame(height: style.diameter)
}

private func tripleAvatarView(
Expand All @@ -116,7 +124,6 @@ struct AvatarsView: View {
.avatarBorderOverlay()
}
}
.frame(height: Length.Padding.large + style.diameter)
}
}

Expand Down Expand Up @@ -150,30 +157,3 @@ private extension View {
)
}
}

#if DEBUG
#Preview {
VStack(spacing: Length.Padding.medium) {
AvatarsView(
style: .single(
URL(string: "https://i.pickadummy.com/index.php?imgsize=40x40")!
)
)
AvatarsView(
style: .double(
URL(string: "https://i.pickadummy.com/index.php?imgsize=34x34")!,
URL(string: "https://i.pickadummy.com/index.php?imgsize=34x34")!
)
)
AvatarsView(
style: .init(
urls: [
URL(string: "https://i.pickadummy.com/index.php?imgsize=28x28")!,
URL(string: "https://i.pickadummy.com/index.php?imgsize=28x28")!,
URL(string: "https://i.pickadummy.com/index.php?imgsize=28x28")!
]
)!
)
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ fileprivate extension NotificationsTableViewCellContent {
}
Spacer()
}
.offset(x: 0, y: info.avatarStyle.verticalOffset)
.padding(.trailing, Length.Padding.double)
}

Expand Down

0 comments on commit 0ee88c7

Please sign in to comment.