ybbond-reason

My old site written in ReasonReact
Log | Files | Refs | README | LICENSE | CC-LICENSE

App.re (1288B)


      1 module Styles = {
      2   open Css;
      3 
      4   let container =
      5     style([
      6       minHeight(vh(100.0)),
      7       flexGrow(1.0),
      8       flexShrink(1.0),
      9       flexBasis(`auto),
     10       display(`flex),
     11       flexDirection(`column),
     12       textAlign(`left),
     13       padding(`em(1.0)),
     14       paddingTop(`px(0)),
     15       paddingBottom(`px(0)),
     16       fontSize(`em(0.9)),
     17     ]);
     18 
     19   let main =
     20     style([
     21       flexGrow(1.0),
     22       width(`percent(100.0)),
     23       marginTop(`px(0)),
     24       marginBottom(`px(0)),
     25       marginLeft(`auto),
     26       marginRight(`auto),
     27       maxWidth(`em(50.0)),
     28     ]);
     29 };
     30 
     31 [@react.component]
     32 let make = () => {
     33   let url = ReasonReact.Router.useUrl();
     34 
     35   Js.log("Written with ReasonReact!");
     36 
     37   let content = () =>
     38     switch (url.path) {
     39     | [] => <CurViScene />
     40     | ["uses"] => <UsesScene />
     41     | ["blog"] => <BlogScene />
     42     | ["blog", slug, id] => <BlogContentScene slug id />
     43     | ["poem"] =>
     44       ReasonReact.Router.replace("poems");
     45       <PoemsScene />;
     46     | ["poems"] => <PoemsScene />
     47     | _ =>
     48       ReasonReact.Router.replace("/");
     49       <CurViScene />;
     50     };
     51 
     52   <div className=Styles.container>
     53     <div className=Styles.main>
     54       <Styled />
     55       <Header current={url.path !== [] ? List.hd(url.path) : "/"} />
     56       {content()}
     57     </div>
     58     <Footer />
     59   </div>;
     60 };