Skip to content

Commit

Permalink
revert me
Browse files Browse the repository at this point in the history
  • Loading branch information
chandlerprall committed Jul 6, 2022
1 parent 5bff3ca commit fa3f198
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 353 deletions.
122 changes: 104 additions & 18 deletions src-docs/src/views/drag_and_drop/drag_and_drop_custom_handle.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import {
EuiDragDropContext,
EuiDraggable,
EuiDroppable,
EuiFlexGroup,
EuiFlexItem,
EuiIcon,
EuiPanel,
euiDragDropReorder,
EuiAccordion,
EuiButtonIcon,
} from '../../../../src/components';
import { htmlIdGenerator } from '../../../../src/services';

Expand All @@ -21,7 +20,7 @@ const makeList = (number, start = 1) =>
};
});

export default () => {
export const Demo = () => {
const [list, setList] = useState(makeList(3));
const onDragEnd = ({ source, destination }) => {
if (source && destination) {
Expand All @@ -37,30 +36,56 @@ export default () => {
spacing="m"
withPanel
>
{list.map(({ content, id }, idx) => (
{list.map(({ id }, idx) => (
<EuiDraggable
spacing="m"
key={id}
index={idx}
draggableId={id}
customDragHandle={true}
hasInteractiveChildren={true}
disableInteractiveElementBlocking
>
{(provided) => (
<EuiPanel paddingSize="s">
<EuiFlexGroup alignItems="center" gutterSize="s">
<EuiFlexItem grow={false}>
<EuiPanel
color="transparent"
paddingSize="s"
<EuiAccordion
id={id}
initialIsOpen={false}
buttonContent={<>Button</>}
extraAction={[
<EuiButtonIcon
key={1}
iconType="grab"
color={'text'}
{...provided.dragHandleProps}
aria-label="Drag Handle"
>
<EuiIcon type="grab" />
</EuiPanel>
</EuiFlexItem>
<EuiFlexItem>{content}</EuiFlexItem>
</EuiFlexGroup>
aria-label="fsdfsdfsd"
/>,
]}
>
dsfds fsd
<br />
dsfds fsd
<br />
dsfds fsd
<br />
dsfds fsd
<br />
dsfds fsd
<br />
dsfds fsd
<br />
dsfds fsd
<br />
dsfds fsd
<br />
dsfds fsd
<br />
dsfds fsd
<br />
dsfds fsd
<br />
dsfds fsd
<br />
</EuiAccordion>
</EuiPanel>
)}
</EuiDraggable>
Expand All @@ -69,3 +94,64 @@ export default () => {
</EuiDragDropContext>
);
};

export default Demo;

// const makeId = htmlIdGenerator();
//
// const makeList = (number, start = 1) =>
// Array.from({ length: number }, (v, k) => k + start).map((el) => {
// return {
// content: `Item ${el}`,
// id: makeId(),
// };
// });
//
// export default () => {
// const [list, setList] = useState(makeList(3));
// const onDragEnd = ({ source, destination }) => {
// if (source && destination) {
// const items = euiDragDropReorder(list, source.index, destination.index);
//
// setList(items);
// }
// };
// return (
// <EuiDragDropContext onDragEnd={onDragEnd}>
// <EuiDroppable
// droppableId="CUSTOM_HANDLE_DROPPABLE_AREA"
// spacing="m"
// withPanel
// >
// {list.map(({ content, id }, idx) => (
// <EuiDraggable
// spacing="m"
// key={id}
// index={idx}
// draggableId={id}
// customDragHandle={true}
// hasInteractiveChildren={true}
// >
// {(provided) => (
// <EuiPanel paddingSize="s">
// <EuiFlexGroup alignItems="center" gutterSize="s">
// <EuiFlexItem grow={false}>
// <EuiPanel
// color="transparent"
// paddingSize="s"
// {...provided.dragHandleProps}
// aria-label="Drag Handle"
// >
// <EuiIcon type="grab" />
// </EuiPanel>
// </EuiFlexItem>
// <EuiFlexItem>{content}</EuiFlexItem>
// </EuiFlexGroup>
// </EuiPanel>
// )}
// </EuiDraggable>
// ))}
// </EuiDroppable>
// </EuiDragDropContext>
// );
// };
Loading

0 comments on commit fa3f198

Please sign in to comment.