Polish demo app

This commit is contained in:
david-swift 2024-05-06 16:18:49 +02:00
parent 932e4aeb8c
commit 212af591f1
11 changed files with 38 additions and 31 deletions

View File

@ -20,6 +20,7 @@ struct AlertDialogDemo: View {
dialog = true
}
.style("pill")
.style("suggested-action")
.frame(maxWidth: 100)
.padding()
}

View File

@ -100,35 +100,35 @@ struct Demo: App {
}
}
} content: {
StatusPage(
selection.label,
icon: selection.icon,
description: selection.description
) { selection.view(app: app, window: window, toast: toast, pictureURL: pictureURL) }
.topToolbar {
HeaderBar {
Toggle(icon: .default(icon: .sidebarShow), isOn: $sidebarVisible)
.tooltip("Toggle Sidebar")
} end: {
if sidebarVisible {
Text("")
.transition(.crossfade)
} else {
menu
.transition(.crossfade)
}
}
.headerBarTitle {
if sidebarVisible {
Text("")
.transition(.crossfade)
} else {
WindowTitle(subtitle: "Demo", title: selection.label)
.transition(.crossfade)
ViewStack(element: selection) { selection in
StatusPage(
selection.label,
icon: selection.icon,
description: selection.description
) { selection.view(app: app, window: window, toast: toast, pictureURL: pictureURL) }
.topToolbar {
HeaderBar {
Toggle(icon: .default(icon: .sidebarShow), isOn: $sidebarVisible)
.tooltip("Toggle Sidebar")
} end: {
if sidebarVisible {
Text("").transition(.crossfade)
} else {
menu.transition(.crossfade)
}
}
.headerBarTitle {
if sidebarVisible {
Text("")
.transition(.crossfade)
} else {
WindowTitle(subtitle: "Demo", title: selection.label)
.transition(.crossfade)
}
}
}
.toast("This is a toast!", signal: toast)
}
.toast("This is a toast!", signal: toast)
}
.aboutDialog(
visible: $about,

View File

@ -22,6 +22,7 @@ struct DialogDemo: View {
dialog = true
}
.style("pill")
.style("suggested-action")
.frame(maxWidth: 100)
.padding()
}

View File

@ -19,6 +19,7 @@ struct FormDemo: View {
app.showWindow("form-demo")
}
.style("suggested-action")
.style("pill")
.frame(maxWidth: 100)
}
}

View File

@ -23,11 +23,9 @@ struct IdleDemo: View {
.valign(.center)
.frame(maxWidth: maxWidth)
Button("Play") {
activeProcess = true
progress = 0
Task {
Idle {
activeProcess = true
progress = 0
}
Idle(delay: .seconds(delayFactor / max)) {
progress += 1
let done = progress == max

View File

@ -19,6 +19,7 @@ struct NavigationViewDemo: View {
app.showWindow("navigation")
}
.style("suggested-action")
.style("pill")
.frame(maxWidth: 100)
.padding()
}

View File

@ -10,7 +10,7 @@
import Adwaita
import Foundation
enum Page: String, Identifiable, CaseIterable, Codable {
enum Page: String, Identifiable, CaseIterable, Codable, CustomStringConvertible {
case welcome
case counter

View File

@ -19,6 +19,7 @@ struct PopoverDemo: View {
visible = true
}
.style("suggested-action")
.style("pill")
.frame(maxWidth: 100)
.popover(visible: $visible) {
CounterDemo()

View File

@ -19,6 +19,7 @@ struct ToastDemo: View {
toast.signal()
}
.style("suggested-action")
.style("pill")
.frame(maxWidth: 100)
}
}

View File

@ -19,6 +19,7 @@ struct ToolbarDemo: View {
app.showWindow("toolbar-demo")
}
.style("suggested-action")
.style("pill")
.frame(maxWidth: 100)
}
}
@ -34,6 +35,7 @@ struct ToolbarDemo: View {
visible.toggle()
}
.style("suggested-action")
.style("pill")
.frame(maxWidth: 100)
.padding(15)
}

View File

@ -19,6 +19,7 @@ struct ViewSwitcherDemo: View {
app.showWindow("switcher-demo")
}
.style("suggested-action")
.style("pill")
.frame(maxWidth: 100)
}
}