ybbond-reason

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

Header.re (1368B)


      1 module Styles = {
      2   open Css;
      3 
      4   let strikethrough = style([textDecoration(`lineThrough)]);
      5   let underline = style([textDecoration(`underline)]);
      6   let h1 = style([fontWeight(`num(400)), fontSize(`em(1.4))]);
      7 };
      8 
      9 type contentType = {
     10   title: string,
     11   path: string,
     12 };
     13 
     14 let content: array(contentType) = [|
     15   {title: "CV", path: "/"},
     16   {title: "Poems-Verses", path: "poems"},
     17   {title: "Uses", path: "uses"},
     18   {title: "Blog (WIP)", path: "blog"},
     19 |];
     20 
     21 [@react.component]
     22 let make = (~current: string) => {
     23   let contentElements =
     24     Array.mapi(
     25       (index, item) => {
     26         let separator = index !== Array.length(content) - 1 ? " / " : "";
     27         let res =
     28           item.path === current
     29             ? <React.Fragment key=index>
     30                 <span className=Styles.strikethrough>
     31                   {ReasonReact.string(item.title)}
     32                 </span>
     33                 <span> {ReasonReact.string(separator)} </span>
     34               </React.Fragment>
     35             : <React.Fragment key=index>
     36                 <Link internal={item.path} text={item.title} />
     37                 <span> {ReasonReact.string(separator)} </span>
     38               </React.Fragment>;
     39 
     40         res;
     41       },
     42       content,
     43     );
     44 
     45   <header>
     46     <h1 className=Styles.h1>
     47       {ReasonReact.string("Yohanes Bandung Bondowoso")}
     48     </h1>
     49     {React.array(contentElements)}
     50   </header>;
     51 };