Sha256: 913fa45032d2c6e50ab7370903876e1cce0f140b02eb85dde37f47d0e57d2599

Contents?: true

Size: 1 KB

Versions: 5

Compression:

Stored size: 1 KB

Contents

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

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

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

  return (
    <>
    <DraggableProvider initialItems={data}
        onChange={(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

5 entries across 5 versions & 2 rubygems

Version Path
playbook_ui_docs-13.29.0.pre.alpha.removeduplicatekitexampleclass3063 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui-13.29.0.pre.alpha.removeduplicatekitexampleclass3063 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui_docs-13.29.0.pre.alpha.testingcollapsibleissue3052 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui-13.29.0.pre.alpha.testingcollapsibleissue3052 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui-13.29.0 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx