Skip to content

Instantly share code, notes, and snippets.

open Belt;
[@bs.deriving abstract]
type queryConfig('data, 'key, 'fnParamsFilter) = {
[@bs.optional]
retry: int,
[@bs.optional]
retryDelay: int,
[@bs.optional]
initialData: unit => 'data,
type viewport = ReactMapGL.viewport;
type datum = {
coordinates: array(float),
/**The following fields are custom. They're based on our nodes data */
node_type: string,
region: string,
node_status: string,
id: string,
};
[@bs.module "react-json-view"] [@react.component]
external make: (~src: 'a, ~label: string) => React.element = "default";
/**To bind to formik we'll need to most likely use Js.Dict.t type to accomodate the variable property fields
* https://github.com/jaredpalmer/formik/blob/master/packages/formik/src/types.tsx
* Functors might also be an option: https://2ality.com/2018/01/functors-reasonml.html
*/
type values('v) = 'v;
type errors('e) = 'e;
type touched('t) = 't;
type state('v, 'e, 't, 's) = {
type dayjs;
[@bs.module] external dayjs: string => dayjs = "dayjs";
[@bs.send] external format: (dayjs, string) => string = "format";
open Css;
let defaultAnimationFrame = (position: int) => (
position,
[transform(`scale((1.0, 1.0)))],
);
let loaderAnimation =
keyframes([
defaultAnimationFrame(0),
defaultAnimationFrame(20),
[@bs.module "react"]
external useMemo8:
([@bs.uncurry] (unit => 'any), ('a, 'b, 'c, 'd, 'e, 'f, 'g, 'h)) => 'any =
"useMemo";
[@bs.module "react"]
external useCallback4:
([@bs.uncurry] ('input => 'output), ('a, 'b, 'c, 'd)) =>
React.callback('input, 'output) =
"useCallback";
type width = string;
type height = string;
type latitude = float;
type longitude = float;
type zoom = int;
type viewport = {
.
"width": width,
"height": height,
type formatUSDProps = {
amount: float,
decimalPlaces: int,
};
[@bs.module] external formatUSDUtil: formatUSDProps => float = "format-usd";
let format0 = amount => formatUSDUtil({amount, decimalPlaces: 0});
let handleEnterPressOnKeyDown = (event, callback) => {
ReactEvent.Synthetic.persist(event);
if (event->ReactEvent.Keyboard.which == 13
|| event->ReactEvent.Keyboard.keyCode == 13) {
callback();
};
};
let handleArrowUpPressOnKeyDown = (event, callback) => {
ReactEvent.Synthetic.persist(event);