Skip to content

Instantly share code, notes, and snippets.

@alex35mil
Last active May 24, 2020 13:55
Show Gist options
  • Save alex35mil/4c4cfdbba432c696c8e2e70fe201c45a to your computer and use it in GitHub Desktop.
Save alex35mil/4c4cfdbba432c696c8e2e70fe201c45a to your computer and use it in GitHub Desktop.
FCM
<TextField
icon=(module IconOk)
value
onChange=change
/>
module type Component = {
[@react.component]
let make: (~color: Color.t, ~className: string=?) => React.element;
};
[@react.component]
let make = (~className="", ~children) => {
<Svg className={...}>
children
</Svg>
};
[@react.component]
let make = (~color, ~className=?) => {
<Icon size ?className>
<path fill={color->Icon.Color.toString} />
</Icon>
};
[@react.component]
let make =
(
~value: string,
~icon: option(module Icon.Component)=?,
~onChange: option(ReactEvent.Form.t => unit)=?,
) =>
<>
<input value ?onChange />
{
switch (icon) {
| Some(icon) =>
let (module Icon) = icon;
<Icon color={...} />;
| None => React.null
}
}
</>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment