IceCubesApp/Packages/Status/Sources/Status/Row/Subviews/StatusRowSpoilerView.swift
2023-03-06 15:21:26 +01:00

41 lines
1.2 KiB
Swift

import DesignSystem
import Models
import SwiftUI
struct StatusRowSpoilerView: View {
let status: AnyStatus
@Binding var displaySpoiler: Bool
var body: some View {
HStack(alignment: .top) {
Text("⚠︎")
.font(.system(.subheadline, weight: .bold))
.foregroundColor(.secondary)
EmojiTextApp(status.spoilerText, emojis: status.emojis, language: status.language)
.font(.system(.subheadline, weight: .bold))
.emojiSize(Font.scaledSubheadlineFont.emojiSize)
.emojiBaselineOffset(Font.scaledSubheadlineFont.emojiBaselineOffset)
.foregroundColor(.secondary)
.multilineTextAlignment(.leading)
Spacer()
Button {
withAnimation {
displaySpoiler.toggle()
}
} label: {
Image(systemName: "chevron.down")
.rotationEffect(Angle(degrees: displaySpoiler ? 0 : 180))
}
.buttonStyle(.bordered)
.accessibility(label: displaySpoiler ? Text("status.show-more") : Text("status.show-less"))
.accessibilityHidden(true)
}
.contentShape(Rectangle())
.onTapGesture { // make whole row tapable to make up for smaller button size
withAnimation {
displaySpoiler.toggle()
}
}
}
}