Skip to content

Instantly share code, notes, and snippets.

@mauriciofierrom
Forked from SllyQ/Dnd.re
Created August 26, 2018 04:16
Show Gist options
  • Select an option

  • Save mauriciofierrom/07527a0d8133057fb4605aec14d8609d to your computer and use it in GitHub Desktop.

Select an option

Save mauriciofierrom/07527a0d8133057fb4605aec14d8609d to your computer and use it in GitHub Desktop.

Revisions

  1. @SllyQ SllyQ created this gist Nov 14, 2017.
    34 changes: 34 additions & 0 deletions Dnd.re
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    open ExtUtils;

    module DragDropContext = {
    [@bs.module "react-beautiful-dnd"] external reactClass : ReasonReact.reactClass =
    "DragDropContext";
    Js.log(reactClass);
    let make = (~onDragEnd, children) =>
    ReasonReact.wrapJsForReason(~reactClass, ~props={"onDragEnd": onDragEnd}, children);
    };

    module Draggable = {
    [@bs.module "react-beautiful-dnd"] external reactClass : ReasonReact.reactClass = "Draggable";
    let make = (~draggableId, ~render, _) =>
    ReasonReact.wrapJsForReason(
    ~reactClass,
    ~props={
    "draggableId": draggableId
    },
    Obj.magic(render)
    );
    };

    module Droppable = {
    [@bs.module "react-beautiful-dnd"] external reactClass : ReasonReact.reactClass = "Droppable";
    let make = (~render, ~droppableId, ~isDropDisabled=?, _) =>
    ReasonReact.wrapJsForReason(
    ~reactClass,
    ~props={
    "droppableId": droppableId,
    "isDropDisabled": isDropDisabled |> jsOptBool |> Js.Nullable.from_opt
    },
    Obj.magic(render)
    );
    };