mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
added a TombstonedAvatarImage view to be used for the .tombstoned case
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user