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 ImageWrapper = [%styled | |
Image; | |
() => [ | |
width(Pt(100)) | |
] | |
]; | |
module Wrapper = [%styled | |
Image; | |
(~bg) => [ |
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
type hoc = ReasonReact.reactClass => ReasonReact.reactClass; | |
type router; | |
module WithRouter = { | |
[@bs.module "react-router"] external withRouter : hoc = | |
"withRouter"; | |
type children = (~router: router) => ReasonReact.reactElement; | |
let component = ReasonReact.statelessComponent("WithRouter"); | |
let make' = (~router: router, children: children) => { |
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 ReMotionConfig = { | |
type state = | Open | Closed; | |
let animateForState = fun | Open => [opacity(1)] | Closed => [opacity(0)]; | |
}; | |
module Motion = ReMotion.Make(ReMotionConfig); | |
<Motion state=Closed> | |
...(({ style, setState, state, transitioning }) => { |
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
[{pstr_desc = | |
Pstr_module | |
{pmb_name = {txt = "FormConfig"}; | |
pmb_expr = | |
{pmod_desc = | |
Pmod_structure | |
[{pstr_desc = | |
Pstr_type | |
[{ptype_name = {txt = "field"}; |
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 FormConfig = { | |
type field(_) = | |
| Email: field(string) | |
| Age: field(int); | |
type state = { | |
email: string, | |
age: int, | |
}; | |
let get: type value. (state, field(value)) => value = |
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 type Config = { | |
type field('a); | |
type state; | |
let initialState: state; | |
let set: (state, field('a), 'a) => state; | |
}; | |
module Make = (Config: Config) => { | |
let state = ref(Config.initialState); |
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
import React from 'react' | |
import immutagen from 'immutagen' | |
export default component => { | |
const generator = immutagen(component) | |
const compose = context => { | |
const value = context.value | |
return context.next | |
? React.cloneElement(value, null, values => compose(context.next(values))) |
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 type StyledWrapper = {}; | |
let styled = (declarations, componentMake) => { | |
module Styled = { | |
let make = componentMake(~className=(Css.style(declarations))); | |
}; | |
((module Styled): (module StyledWrapper)); | |
}; | |
module Wrapper = (val styled(Css.([padding(px(20))]), (~className) => MD.Grid.make(~className))); |
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
const mail = (foo, t) => new Promise((resolve) => setTimeout(() => { console.log(foo); resolve() }, t)) | |
async function doThing() { | |
const items = ['foo', 'bar', 'buz', 'fuz']; | |
await waterfall(items.map((item) => async () => { await mail('mailing' + item, 4000); })) | |
await mail("end", 1000) | |
} |
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 type Config = { | |
type state; | |
type fields; | |
let lens: list((fields, state => ReForm.Value.t, (state, ReForm.Value.t) => state)); | |
}; | |
module Create = (Config: Config) => { | |
module Form = ReForm.Create(Config); | |
type fieldSchema = { | |
field: Config.fields, |