Implement a basic <Text> component in Cocoa - it's cool because it really just uses the same Component lifecycle. Neat!

This commit is contained in:
Ryan McGrath 2019-05-24 23:32:40 -07:00
parent 22e9628b27
commit e17f05dec5
No known key found for this signature in database
GPG key ID: 811674B62B666830
11 changed files with 205 additions and 42 deletions

View file

@ -9,7 +9,7 @@
use alchemy::{
AppDelegate, Component, Fragment, Props, Error, rsx, RSX, styles,
View, Window, WindowDelegate
Text, View, Window, WindowDelegate
};
pub struct AppState {
@ -48,6 +48,7 @@ impl WindowDelegate for WindowState {
Ok(rsx! {
<View styles={messages}>
<Text styles=["message"]>"Hello there, my name is Bert"</Text>
<View styles=["boxxx"] />
/*{messages.iter().map(|message| rsx! {
<View>{text!("{}", message)}</View>
@ -67,6 +68,7 @@ fn main() {
let app = alchemy::shared_app();
app.register_styles("default", styles! {
message { width: 500; height: 100; background-color: yellow; color: black; }
LOL {
background-color: #307ace;
width: 500;