mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
08d02001bf
* Use our standard XYZMock(.init()) pattern everywhere instead of XYZMock.default. * Remove the configuration parameter label on mock convenience inits. * Update the enterprise submodule.
53 lines
1.8 KiB
Swift
53 lines
1.8 KiB
Swift
//
|
|
// Copyright 2025 Element Creations Ltd.
|
|
// Copyright 2023-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 SpaceAddRoomsScreenSelectedItem: View {
|
|
let room: SpaceAddRoomsScreenRoom
|
|
let mediaProvider: MediaProviderProtocol?
|
|
let dismissAction: () -> Void
|
|
|
|
var body: some View {
|
|
VStack(spacing: 10) {
|
|
avatar
|
|
.accessibilityHidden(true)
|
|
|
|
Text(room.title)
|
|
.font(.compound.bodySM)
|
|
.foregroundColor(.compound.textSecondary)
|
|
.lineLimit(1)
|
|
}
|
|
.accessibilityElement(children: .combine)
|
|
.accessibilityAction(named: L10n.actionRemove, dismissAction)
|
|
}
|
|
|
|
// MARK: - Private
|
|
|
|
var avatar: some View {
|
|
RoomAvatarImage(avatar: room.avatar,
|
|
avatarSize: .room(on: .spaceAddRoomsSelected),
|
|
mediaProvider: mediaProvider)
|
|
.overlayRemoveItemButton(action: dismissAction)
|
|
}
|
|
}
|
|
|
|
struct SpaceAddRoomsScreenSelectedItem_Previews: PreviewProvider, TestablePreview {
|
|
static var previews: some View {
|
|
SpaceAddRoomsScreenSelectedItem(room: .init(id: "",
|
|
title: "Selected Room",
|
|
description: "#selected:matrix.org",
|
|
avatar: .room(id: "",
|
|
name: "Selected Room",
|
|
avatarURL: .mockMXCAvatar)),
|
|
mediaProvider: MediaProviderMock(.init())) { }
|
|
.frame(width: 80)
|
|
}
|
|
}
|