Sha256: 21af55607a5db35bbec2d06cd3726e8234f29e581478c884c123c53956b76546

Contents?: true

Size: 1.09 KB

Versions: 948

Compression:

Stored size: 1.09 KB

Contents

import React, { useState } from "react";
import { Flex, Image, Draggable, DraggableProvider } from "playbook-ui";

// Initial items to be dragged
const data = [
  {
    id: "21",
    url: "https://unsplash.it/500/400/?image=633",
  },
  {
    id: "22",
    url: "https://unsplash.it/500/400/?image=634",
  },
  {
    id: "23",
    url: "https://unsplash.it/500/400/?image=637",
  },
];

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

  return (
    <>
    <DraggableProvider initialItems={data}
        onReorder={(items) => setInitialState(items)}
    >
        <Draggable.Container {...props}>
        <Flex>
            {initialState.map(({ id, url }) => (
              <Draggable.Item dragId={id} 
                  key={id}
              >
                <Image alt={id} 
                    margin="xs"
                    size="md" 
                    url={url} 
                />
              </Draggable.Item>
            ))}
         </Flex>
        </Draggable.Container>
    </DraggableProvider>
    </>

  );
};

export default DraggableDefault;

Version data entries

948 entries across 948 versions & 2 rubygems

Version Path
playbook_ui_docs-14.11.1.pre.alpha.PLAY1750pbcontenttagkitbutton5340 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui-14.11.1.pre.alpha.PLAY1750pbcontenttagkitbutton5340 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui_docs-14.11.1.pre.alpha.PLAY1750pbcontenttagkitbutton5339 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui-14.11.1.pre.alpha.PLAY1750pbcontenttagkitbutton5339 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui_docs-14.12.0.pre.rc.3 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui-14.12.0.pre.rc.3 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui_docs-14.12.0.pre.rc.2 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui-14.12.0.pre.rc.2 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui_docs-14.12.0.pre.rc.1 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui-14.12.0.pre.rc.1 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui_docs-14.12.0.pre.rc.0 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui-14.12.0.pre.rc.0 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui_docs-14.10.0.pre.alpha.PLAY1774timelinelabelstepspacing5315 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui-14.10.0.pre.alpha.PLAY1774timelinelabelstepspacing5315 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui_docs-14.10.0.pre.alpha.PLAY1774timelinelabelstepspacing5314 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui-14.10.0.pre.alpha.PLAY1774timelinelabelstepspacing5314 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui_docs-14.10.0.pre.alpha.PLAY1750pbcontenttagkitbutton5308 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui-14.10.0.pre.alpha.PLAY1750pbcontenttagkitbutton5308 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui-14.11.1 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui_docs-14.11.0.pre.rc.17 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx