mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
b46189d05f
* Add a common .inverseMask view modifier and use a blend mode for efficiency.
This also fixes the snapshot rendering 🎉
* Add support for the status emoji on the app's Setting button.
* Align the room header decoration icons with the status emoji.
* Add missing snapshots.
43 lines
1.2 KiB
Swift
43 lines
1.2 KiB
Swift
//
|
|
// Copyright 2026 Element Creations 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
|
|
|
|
extension View {
|
|
func overlayRemoveItemButton(action: @escaping () -> Void) -> some View {
|
|
modifier(RemoveItemButtonViewModifier(action: action))
|
|
}
|
|
}
|
|
|
|
private struct RemoveItemButtonViewModifier: ViewModifier {
|
|
let action: () -> Void
|
|
|
|
func body(content: Content) -> some View {
|
|
content
|
|
.inverseMask(alignment: .topTrailing) {
|
|
closeButtonLabel
|
|
.hidden()
|
|
.padding(2)
|
|
.overlay { Circle() }
|
|
.offset(x: 2, y: -2)
|
|
}
|
|
.overlay(alignment: .topTrailing) {
|
|
Button(action: action) {
|
|
closeButtonLabel
|
|
}
|
|
}
|
|
}
|
|
|
|
var closeButtonLabel: some View {
|
|
CompoundIcon(\.close, size: .custom(12), relativeTo: .compound.bodySM)
|
|
.foregroundStyle(.compound.iconOnSolidPrimary)
|
|
.padding(2)
|
|
.background(.compound.iconPrimary, in: Circle())
|
|
}
|
|
}
|