import { KitThemeContext } from "@kit";
import { InterFont } from "@kit-fonts/inter.slint";
// SPDX-License-Identifier: GPL-3.0-or-later
import { KitPopover, KitTheme, KitThemes } from "@kit";

export component App inherits Window {
    default-font-family: InterFont.family;
    title: "KitPopover example";
    preferred-width: 480px;
    preferred-height: 320px;
    max-width: 100000px;
    max-height: 100000px;
    background: root.theme.canvas;
    in-out property <KitTheme> theme: KitThemeContext.current;
    in-out property <string> status: "No action yet";
    VerticalLayout {
        padding: 24px;
        spacing: 12px;
        alignment: start;
        KitPopover {
            theme: root.theme;
            text: "Project details";
            popup-width: 280px * root.theme.text-scale;
            opened => { root.status = "Details opened"; }
            dismissed(reason) => { root.status = "Details closed"; }
            Text { text: "Field notes"; color: root.theme.text-primary; font-size: 14px * root.theme.text-scale; wrap: word-wrap; vertical-stretch: 0; max-height: self.preferred-height; }
            Text { text: "Updated this morning"; color: root.theme.text-secondary; font-size: 12px * root.theme.text-scale; wrap: word-wrap; vertical-stretch: 0; max-height: self.preferred-height; }
        }
        Text { text: root.status; color: root.theme.text-secondary; font-size: 12px * root.theme.text-scale; }
    }
}
