Last active
March 11, 2019 16:07
-
-
Save ndugger/3ecbfcf397f4e9ca3000db0a9ac74220 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mod wjet; | |
| use wjet::core::Event; | |
| use wjet::core::Tree; | |
| use wjet::core::Widget; | |
| use crate::button::Button; | |
| use crate::layout::FlexBox; | |
| pub struct Form; | |
| impl Form { | |
| fn handle_submit(&self, event: Event<Form>) { | |
| println!("form was submitted"); | |
| } | |
| } | |
| impl Widget for Form { | |
| fn render(&self, children: Tree) -> Tree { | |
| let enable_message = true; | |
| wml! { | |
| <FlexBox { direction: "vertical" }> | |
| #[if(enable_message)] { | |
| <Typography { variant: "message" }> | |
| <{ "This Is A Message" };> | |
| <;Typography> | |
| } | |
| <Button { emit: "submit", height: 32, width: 256 }> | |
| <{ "Submit Form" };> | |
| <;Button> | |
| <;FlexBox> | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment