mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-04-27 02:14:45 +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 {
|
if !viewModel.status.spoilerText.isEmpty {
|
||||||
Text(status.spoilerText)
|
Text(status.spoilerText)
|
||||||
.font(.body)
|
.font(.body)
|
||||||
}
|
|
||||||
if viewModel.displaySpoiler {
|
|
||||||
Button {
|
Button {
|
||||||
withAnimation {
|
withAnimation {
|
||||||
viewModel.displaySpoiler = false
|
viewModel.displaySpoiler.toggle()
|
||||||
}
|
}
|
||||||
} label: {
|
} label: {
|
||||||
Text("Show more")
|
Text(viewModel.displaySpoiler ? "Show more" : "Show less")
|
||||||
}
|
}
|
||||||
.buttonStyle(.bordered)
|
.buttonStyle(.bordered)
|
||||||
} else {
|
}
|
||||||
|
if !viewModel.displaySpoiler {
|
||||||
Text(status.content.asSafeAttributedString)
|
Text(status.content.asSafeAttributedString)
|
||||||
.font(.body)
|
.font(.body)
|
||||||
.environment(\.openURL, OpenURLAction { url in
|
.environment(\.openURL, OpenURLAction { url in
|
||||||
|
|
Loading…
Reference in a new issue