Sha256: 84d6b0245144858fd482008e8eb4cc5fc0fbb7d80eaaaa6652a85f866ccc9086

Contents?: true

Size: 1.08 KB

Versions: 50

Compression:

Stored size: 1.08 KB

Contents

import React, { useState } from "react";
import { Flex, Image, Draggable, DraggableProvider } from "../../";

// 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

50 entries across 50 versions & 2 rubygems

Version Path
playbook_ui_docs-13.34.1.pre.alpha.play1407statvaluekitinconsistencies3388 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui-13.34.1.pre.alpha.play1407statvaluekitinconsistencies3388 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui_docs-13.34.1.pre.alpha.PLAY14703378 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui-13.34.1.pre.alpha.PLAY14703378 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui_docs-13.34.1 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui-13.34.1 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui_docs-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3370 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3370 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui_docs-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3369 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3369 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3368 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui_docs-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3366 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3366 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui-13.34.0 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui_docs-13.33.1.pre.alpha.play1407statvaluekitinconsistencies3352 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui-13.33.1.pre.alpha.play1407statvaluekitinconsistencies3352 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui_docs-13.33.1.pre.alpha.PLAY14063320 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui-13.33.1.pre.alpha.PLAY14063320 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui-13.33.1 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
playbook_ui_docs-13.33.0.pre.alpha.PBNTR405dropdownformfixesrails3311 app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx