Sha256: 503dafe97f3855ff9cdcb4d27c8a0380287060b2ec4dea74f9a2b8facda26fb2

Contents?: true

Size: 1.01 KB

Versions: 7

Compression:

Stored size: 1.01 KB

Contents

import React, { useState } from "react";
import { SelectableList, DraggableProvider } from "../../";

// Initial items to be dragged
const data = [
  {
    id: "41",
    text: "Task 1",
  },
  {
    id: "42",
    text: "Task 2",
  },
  {
    id: "43",
    text: "Task 3",
  },
  {
    id: "44",
    text: "Task 4",
  },
];

const DraggableWithSelectableList = (props) => {
  const [initialState, setInitialState] = useState(data);

  return (
    <>
    <DraggableProvider initialItems={data}
        onReorder={(items) => setInitialState(items)}
    >
          <SelectableList draggable 
              variant="checkbox"
              {...props}
              >
            {initialState.map(({ id, text }) => (
                <SelectableList.Item id={id}
                    key={id}
                    label={text} 
                    name={id} 
                    value={id}
                />
            ))}
          </SelectableList>
    </DraggableProvider>
    </>

  );
};

export default DraggableWithSelectableList

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
playbook_ui_docs-13.30.0.pre.alpha.PLAY1328fixtimelinekitglobalpropsreact3096 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui-13.30.0.pre.alpha.PLAY1328fixtimelinekitglobalpropsreact3096 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui-13.30.0 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui_docs-13.29.0.pre.alpha.PBNTR329draggablev33060 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui-13.29.0.pre.alpha.PBNTR329draggablev33060 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui_docs-13.29.0.pre.alpha.PBNTR329draggablev33059 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui-13.29.0.pre.alpha.PBNTR329draggablev33059 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx