added a TombstonedAvatarImage view to be used for the .tombstoned case

This commit is contained in:
Mauro Romito
2025-06-05 17:53:27 +02:00
committed by Mauro
parent 26a7d5ac82
commit 4662eca9e2
13 changed files with 72 additions and 24 deletions
@@ -0,0 +1,42 @@
//
// Copyright 2025 New Vector Ltd.
//
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
// Please see LICENSE files in the repository root for full details.
//
import Compound
import SwiftUI
struct TombstonedAvatarImage: View {
@ScaledMetric private var frameSize: CGFloat
init(avatarSize: Avatars.Size) {
_frameSize = ScaledMetric(wrappedValue: avatarSize.value)
}
var body: some View {
GeometryReader { geometry in
ZStack(alignment: .center) {
Color.compound.bgSubtlePrimary
Text(verbatim: "!")
.foregroundColor(.compound.iconTertiary)
.font(.system(size: geometry.size.width * 0.5625, weight: .semibold))
.minimumScaleFactor(0.001)
.frame(alignment: .center)
}
}
.aspectRatio(1, contentMode: .fill)
.frame(width: frameSize, height: frameSize)
.background(Color.compound.bgCanvasDefault)
.clipShape(Circle())
}
}
struct TombstonedAvatarImage_Previews: PreviewProvider, TestablePreview {
static var previews: some View {
TombstonedAvatarImage(avatarSize: .room(on: .home))
.previewLayout(.sizeThatFits)
}
}