mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-12-22 23:26:37 +00:00
Add option to re-hide spoiler content after expanding (#20)
* Add option to re-hide spoiler content after expanding Uses the same logic as the "Show more" button, but in reverse. This allows a user to hide the content that they expanded. * Use .toggle() method instead of multiple if statements
This commit is contained in:
parent
5fe72e36d2
commit
e9991020ec
1 changed files with 4 additions and 5 deletions
|
@ -139,17 +139,16 @@ public struct StatusRowView: View {
|
|||
if !viewModel.status.spoilerText.isEmpty {
|
||||
Text(status.spoilerText)
|
||||
.font(.body)
|
||||
}
|
||||
if viewModel.displaySpoiler {
|
||||
Button {
|
||||
withAnimation {
|
||||
viewModel.displaySpoiler = false
|
||||
viewModel.displaySpoiler.toggle()
|
||||
}
|
||||
} label: {
|
||||
Text("Show more")
|
||||
Text(viewModel.displaySpoiler ? "Show more" : "Show less")
|
||||
}
|
||||
.buttonStyle(.bordered)
|
||||
} else {
|
||||
}
|
||||
if !viewModel.displaySpoiler {
|
||||
Text(status.content.asSafeAttributedString)
|
||||
.font(.body)
|
||||
.environment(\.openURL, OpenURLAction { url in
|
||||
|
|
Loading…
Reference in a new issue