28 lines
1.3 KiB
Ziran
28 lines
1.3 KiB
Ziran
EmptyState :: #import "kryon/empty_state";
|
|
Text :: #import "kryon/text";
|
|
#import "kryon/geometry"
|
|
#import "kryon/session"
|
|
|
|
created: bool;
|
|
#program_export
|
|
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
|
Text.Draw(session, Text.Props.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Empty state", .size = 28})
|
|
bounds := Rectangle.{viewport.x + 20.0, viewport.y + 76.0, viewport.width - 40.0, 180.0}
|
|
if !created {
|
|
props: EmptyState.Props = .{.disabled = example_disabled, .key = 10, .bounds = .{bounds.x, bounds.y, bounds.width, viewport.height - 96.0}, .title = "No projects yet", .description = "Create your first project.", .action = "Create project"}
|
|
result := EmptyState.Draw(session, props)
|
|
if result.action { created = true }
|
|
} else { Text.Draw(session, Text.Props.{.disabled = example_disabled, .key = 11, .bounds = bounds, .text = "Project created"}) }
|
|
return 0
|
|
}
|
|
|
|
example_disabled: bool;
|
|
example_reduced_motion: bool;
|
|
|
|
// Hosts publish these options before the unchanged application entry point.
|
|
#program_export
|
|
SetExampleOptions :: (disabled: bool, reduced_motion: bool) {
|
|
example_disabled = disabled
|
|
example_reduced_motion = reduced_motion
|
|
}
|