-
Hello, I'm trying to make a LoginForm on the Login page never be larger then 512px, while taking up 50% of the width when it is smaller then 512px. enum Pages {
Login,
Chat,
}
export component MainWindow inherits Window {
in-out property <Pages> current_page: Pages.Login;
if (current_page == Pages.Login): LoginForm {
max-width: 512px;
width: 50%;
service: "Discord";
}
} So now I arrived to this, however it still doesn't work as the syntax for the if statement is wrong. So now I'm wondering if there is a way to have an if statement on just property without touching the component, and how would the correct version of this code look? enum Pages {
Login,
Chat,
}
export component MainWindow inherits Window {
in-out property <Pages> current_page: Pages.Login;
if (current_page == Pages.Login): LoginForm {
if (root.width > 512) { width: 512px } else { width: 50% };
service: "Discord";
}
}
`` |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This hasn't been tested, but you should be able to use the ternary operator:
|
Beta Was this translation helpful? Give feedback.
This hasn't been tested, but you should be able to use the ternary operator: