Skip to content

Commit

Permalink
Update demo
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsaidi committed Apr 23, 2024
1 parent f59904d commit 9ce0f26
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 17 deletions.
35 changes: 22 additions & 13 deletions Demo/Demo/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ struct ContentView: View {
}
// listItem(.globe, "Show localized notification", presentLocalized)
listItem(.warning, "Menu.Warning", presentWarning)
listItem(.warning, "Menu.LocalizedMessage", presentLocalizedMessage)
listItem(.warning, "Menu.CustomView", presentCustomView)
listItem(.warning, "Menu.BottomToast", presentBottomToast)
listItem(.flag, "Menu.LocalizedMessage", presentLocalizedMessage)
listItem(.static, "Menu.CustomView", presentCustomView)
listItem(.sheet, "Menu.BottomToast", presentBottomToast)
// listItem(.error, "Show red error from bottom", presentError)
// listItem(.flag, "Show custom view", presentCustomView)
}
Expand Down Expand Up @@ -100,10 +100,7 @@ struct ContentView: View {
}
#endif
.systemNotification(toast)
.systemNotificationConfiguration(
.init(animation: .bouncy, edge: .bottom)
)
.systemNotificationStyle(.init(backgroundColor: .black))
.systemNotificationConfiguration(.standardToast)

.onChange(of: isSilentModeOn) {
if $0 {
Expand Down Expand Up @@ -167,6 +164,12 @@ private extension ContentView {
title: "Message.Toast.Title",
text: "Message.Toast.Text"
)
.systemNotificationMessageStyle(
.init(
backgroundColor: .black,
padding: .init(width: 30, height: 20)
)
)
.environment(\.colorScheme, .dark)
}
}
Expand Down Expand Up @@ -199,7 +202,7 @@ private extension ContentView {
notification.present {
SystemNotificationMessage(
icon: SilentModeBell(isSilentModeOn: false),
text: "Silent Mode On"
text: "Silent Mode Off"
)
}
}
Expand All @@ -215,11 +218,17 @@ private extension ContentView {

func presentWarning() {
notification.present(
Text("Warning!")
.padding(5)
.padding(.horizontal)
.foregroundStyle(.white)
.background(Color.orange)
SystemNotificationMessage(
icon: Image.warning,
title: "Message.Warning.Title",
text: "Message.Warning.Text"
)
.systemNotificationMessageStyle(
.init(
backgroundColor: .orange,
foregroundColor: .white
)
)
)
}
}
Expand Down
25 changes: 21 additions & 4 deletions Demo/Demo/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "This toast is presented from the bottom because of the custom system notification configuration."
"value" : "This toast is presented from the bottom, and styled a bit."
}
}
}
Expand All @@ -117,6 +117,26 @@
}
}
},
"Message.Warning.Text" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Warning, warning!"
}
}
}
},
"Message.Warning.Title" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Look at the orange color - this is a serious message!"
}
}
}
},
"Section.Modals" : {
"localizations" : {
"en" : {
Expand Down Expand Up @@ -155,9 +175,6 @@
}
}
}
},
"Warning!" : {

}
},
"version" : "1.0"
Expand Down

0 comments on commit 9ce0f26

Please sign in to comment.