Created
March 13, 2020 01:32
-
-
Save ksaldana1/70773351dbc1feb53e34781193c83d01 to your computer and use it in GitHub Desktop.
re_example_fix_2.re
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
module Styles = { | |
open Css; | |
let app = | |
style([ | |
display(`flex), | |
justifyContent(`center), | |
alignItems(`center), | |
flexDirection(`column), | |
minHeight(`vh(100.0)), | |
]); | |
let message = role => | |
switch (role) { | |
| `PREMIUM => style([color(red)]) | |
| `WHALE => style([color(blue)]) | |
| `FREE | |
| `FUTURE_ADDED_VALUE__ => style([color(black)]) | |
}; | |
}; | |
[@react.component] | |
let make = () => { | |
let query = Query.use(~variables=(), ()); | |
<div className=Styles.app> | |
{Belt.Array.map(query.messages, message => { | |
switch (message.author) { | |
| `User(user) => | |
<div className={Styles.message(user.role)}> | |
{React.string(user.name ++ ": " ++ message.text)} | |
</div> | |
| `Guest(guest) => | |
<div> | |
{React.string(guest.placeholder ++ ": " ++ message.text)} | |
</div> | |
| `UnmappedUnionMember => React.null | |
} | |
}) | |
->React.array} | |
</div>; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment