Sha256: 569130271a86ef5081f4738e908fc2ce840267bfe51de28255ab9761c1f4497e

Contents?: true

Size: 923 Bytes

Versions: 1007

Compression:

Stored size: 923 Bytes

Contents

import React, { useState } from "react";
import { DraggableProvider, List, ListItem } from "playbook-ui";

// Initial items to be dragged
const data = [
  {
    id: "31",
    text: "Philadelphia",
  },
  {
    id: "32",
    text: "New Jersey",
  },
  {
    id: "33",
    text: "Maryland",
  },
  {
    id: "34",
    text: "Connecticut",
  },
];

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


  return (
    <>
    <DraggableProvider initialItems={data}
        onReorder={(items) => setInitialState(items)}
    >
        <List enableDrag
            {...props}
        >
            {initialState.map(({ id, text }) => (
                <ListItem dragId={id}
                    key={id}
                >
                    {text}
                </ListItem>
            ))}
        </List>
    </DraggableProvider>
    </>

  );
};

export default DraggableWithList;

Version data entries

1,007 entries across 1,007 versions & 2 rubygems

Version Path
playbook_ui_docs-14.12.0.pre.alpha.play1790darkaudittable5802 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx
playbook_ui-14.12.0.pre.alpha.play1790darkaudittable5802 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx
playbook_ui_docs-14.12.0.pre.alpha.play1752updatecontenttag5801 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx
playbook_ui-14.12.0.pre.alpha.play1752updatecontenttag5801 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx
playbook_ui_docs-14.13.0.pre.rc.6 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx
playbook_ui-14.13.0.pre.rc.6 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx
playbook_ui_docs-14.13.0.pre.rc.5 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx
playbook_ui-14.13.0.pre.rc.5 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx
playbook_ui_docs-14.12.0.pre.alpha.PLAY1602lightboxoverlapnitrobug5781 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx
playbook_ui-14.12.0.pre.alpha.PLAY1602lightboxoverlapnitrobug5781 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx
playbook_ui_docs-14.13.0.pre.rc.4 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx
playbook_ui-14.13.0.pre.rc.4 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx
playbook_ui_docs-14.12.0.pre.alpha.playrailsinputmaskissue5775 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx
playbook_ui-14.12.0.pre.alpha.playrailsinputmaskissue5775 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx
playbook_ui_docs-14.12.0.pre.alpha.PBNTR456fixedconftoastrailsautoclose5757 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx
playbook_ui-14.12.0.pre.alpha.PBNTR456fixedconftoastrailsautoclose5757 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx
playbook_ui_docs-14.12.0.pre.alpha.PBNTR456fixedconftoastrailsautoclose5754 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx
playbook_ui-14.12.0.pre.alpha.PBNTR456fixedconftoastrailsautoclose5754 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx
playbook_ui_docs-14.12.0.pre.alpha.PLAY1602lightboxoverlapnitrobugzindextoken5751 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx
playbook_ui-14.12.0.pre.alpha.PLAY1602lightboxoverlapnitrobugzindextoken5751 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx