Skip to content

Commit

Permalink
Hide embedded config options if embedded not selected
Browse files Browse the repository at this point in the history
  • Loading branch information
porter-stripe committed Sep 30, 2024
1 parent b369514 commit e63fa94
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,16 @@ struct PaymentSheetTestPlayground: View {
SettingView(setting: $playgroundController.settings.collectPhone)
SettingView(setting: $playgroundController.settings.collectAddress)
}
Divider()
Divider().hidden(playgroundController.settings.uiStyle != .embedded)
Group {
HStack {
Text("Embedded only configuration")
.font(.headline)
Spacer()
}
SettingView(setting: $playgroundController.settings.formSheetAction).disabled(playgroundController.settings.uiStyle != .embedded)
SettingView(setting: $playgroundController.settings.hidesMandateText).disabled(playgroundController.settings.uiStyle != .embedded)
}
SettingView(setting: $playgroundController.settings.formSheetAction)
SettingView(setting: $playgroundController.settings.hidesMandateText)
}.hidden(playgroundController.settings.uiStyle != .embedded)

}.padding()
}
Expand Down Expand Up @@ -588,3 +588,9 @@ struct PaymentSheetTestPlayground_Previews: PreviewProvider {
PaymentSheetTestPlayground(settings: .defaultValues())
}
}

extension View {
func hidden(_ shouldHide: Bool) -> some View {
opacity(shouldHide ? 0 : 1)
}
}

0 comments on commit e63fa94

Please sign in to comment.