How to use the react-sortable-hoc.SortableElement function in react-sortable-hoc

To help you get started, we’ve selected a few react-sortable-hoc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github resource-watch / resource-watch / components / ui / LegendOld.js View on Github external
import { connect } from 'react-redux';
import { toggleModal } from 'redactions/modal';
import { toggleTooltip, setTooltipPosition } from 'redactions/tooltip';
import { setLayerGroupOpacity } from 'redactions/explore';

// Components
import LegendType from 'components/ui/LegendType';
import Icon from 'components/ui/Icon';
import LayerInfoModal from 'components/modal/LayerInfoModal';
import LayersTooltip from 'components/app/explore/LayersTooltip';
import SliderTooltip from 'components/app/explore/SliderTooltip';
import Button from 'components/ui/Button';

const TIMELINE_INTERVAL_TIMER = 3000;

const SortableItem = SortableElement(({ value }) => value);

const DragHandle = SortableHandle(() => (
  <span>
    
  </span>
));

const SortableList = SortableContainer(({ items }) =&gt; (
  <ul>
    {items.map((value, index) =&gt;
      
    )}
  </ul>
));

class Legend extends React.PureComponent {
github mirumee / saleor / saleor / static / dashboard-next / products / components / ProductImages / ProductImages.tsx View on Github external
placeholderImage?: string;
  images: ProductDetails_product_images[];
  loading?: boolean;
  onImageDelete: (id: string) =&gt; () =&gt; void;
  onImageEdit: (id: string) =&gt; () =&gt; void;
  onImageUpload(file: File);
  onImageReorder?(event: { oldIndex: number; newIndex: number });
}

interface ImageListContainerProps extends WithStyles {
  items: any;
  onImageDelete: (id: string) =&gt; () =&gt; void;
  onImageEdit: (id: string) =&gt; () =&gt; void;
}

const SortableImage = SortableElement(
  ({ image, onImageEdit, onImageDelete }) =&gt; (
     onImageEdit(image.id) : undefined}
      onImageDelete={onImageDelete}
    /&gt;
  )
);

const ImageListContainer = SortableContainer(
  withStyles(styles, { name: "ImageListContainer" })(
    ({
      classes,
      items,
      onImageDelete,
      onImageEdit,
github mirumee / saleor-dashboard / src / products / components / ProductImages / ProductImages.tsx View on Github external
onImageEdit: (id: string) =&gt; () =&gt; void;
  onImageReorder?: ReorderAction;
  onImageUpload(file: File);
}

interface SortableImageProps {
  image: {
    id: string;
    alt?: string;
    url: string;
  };
  onImageEdit: (id: string) =&gt; void;
  onImageDelete: () =&gt; void;
}

const SortableImage = SortableElement(
  ({ image, onImageEdit, onImageDelete }) =&gt; (
     onImageEdit(image.id) : undefined}
      onImageDelete={onImageDelete}
    /&gt;
  )
);

interface ImageListContainerProps {
  className: string;
  items: ProductDetails_product_images[];
  preview: ProductDetails_product_images[];
  onImageDelete: (id: string) =&gt; () =&gt; void;
  onImageEdit: (id: string) =&gt; () =&gt; void;
}
github fakob / MoviePrint_v004 / app / components / SceneGrid.js View on Github external
import { Icon, Popup } from 'semantic-ui-react';
import Scene from './Scene';
import styles from './SceneGrid.css';
import stylesApp from '../containers/App.css';
import stylesPop from './Popup.css';
import {
  getWidthOfSingleRow, getPreviousScenes, getNextScenes
} from '../utils/utils';
import {
  VIDEOPLAYER_FIXED_PIXEL_PER_FRAME_RATIO,
  VIDEOPLAYER_SCENE_MARGIN,
  VIEW,
  SHEET_TYPE,
} from '../utils/constants';

const SortableScene = SortableElement(Scene);

class SceneGrid extends Component {
  constructor(props) {
    super(props);

    this.state = {
      controllersVisible: undefined,
      scenesToDim: [],
    };

    this.resetHover = this.resetHover.bind(this);

  }

  componentWillMount() {
  }
github medialab / website / admin / src / components / selectors / EditorializationSelector.js View on Github external
const createOptions = (model, items) =&gt; ({
  label: model,
  options: items.map(item =&gt; ({
    value: item.id,
    label: labels[model](item),
    model
  }))
});

const DragHandle = SortableHandle(() =&gt; (
  <span style="{{marginTop:">
    
  </span>
));

const SortableItem = SortableElement(({id, label, model, onDrop}) =&gt; (
  <li>
    <span style="{{marginBottom:">
      
      <small><em>{TITLES[model]}</em></small>&nbsp;- {label}
      &nbsp;<button>
    
  </button></span></li>
));

const SortableList = SortableContainer(({items, index, onDrop}) =&gt; (
  <ul>
    {items.map((item, i) =&gt; (
      </ul>
github JithinKS97 / dynamic-learning / imports / ui / components / workbook / List.jsx View on Github external
import React, { useState } from 'react';
import {
  SortableContainer,
  SortableElement,
  arrayMove,
} from 'react-sortable-hoc';
import PropTypes from 'prop-types';
import { FiTrash } from 'react-icons/fi';

const SortableItem = SortableElement(({
  slideNo,
  props,
}) =&gt; {
  const [hoveringOnDelete, setHoveringOnDelete] = useState(false);
  const [currentHovering, setCurrentHovering] = useState(-1);
  return (
    <div style="{{"> {
        if (!hoveringOnDelete) {
          props.changeSlide(slideNo);</div>
github saadq / resumake.io / app / client / src / features / progress / components / SortableList.js View on Github external
color: ${colors.primary};
  opacity: ${props =&gt; (props.disabled ? '0' : '1')};
  cursor: grab;
  user-select: none;
`

const DragHandle = SortableHandle(({ disabled }) =&gt; {
  return ::
})

const Item = styled.div`
  z-index: 2;
  min-width: 80px;
`

const SortableItem = SortableElement(({ value }) =&gt; {
  return (
    
      
      {titleCase(value)}
    
  )
})

const SortableList = SortableContainer(({ items }) =&gt; {
  return (
    
      {items.map((value, index) =&gt; (
github tremby / contentful-multitext / src / App.js View on Github external
const {
			extension,
		} = this.props;
		const {
			values,
		} = this.state;

		return await extension.field.setValue(values.map(({value}) =&gt; value));
	}
}

const Handle = SortableHandle(() =&gt; (
	<div>
));

const SortableItem = SortableElement(({id, value, onChange, onDelete, autoFocus}) =&gt; (
	<li data-id="{id}">
		
		<input value="{value}">
		<button title="Delete" type="button">
			×
		</button>
	</li>
));

const SortableList = SortableContainer(({items, onChange, onDelete, focus, dragging}) =&gt; (
	<ol>
		{items.map(({id, value}, index) =&gt; (
			</ol></div>
github kirjavascript / Flex2 / modules / components / palettes / index.js View on Github external
import React, { Component } from 'react';
import { environment } from '#store/environment';
import { observer } from 'mobx-react';
import { observable } from 'mobx';
import { SortableContainer, SortableElement, SortableHandle } from 'react-sortable-hoc';
import { hexToMDHex } from '#formats/palette';
import ColorPicker from 'rc-color-picker';

const Handle = SortableHandle(({lineIndex}) =&gt; <div>
    {lineIndex}
</div>);

const SortableItem = SortableElement(observer(({line, lineIndex}) =&gt; (
    <div>
        
        {line.map((color, colorIndex) =&gt; {
            return <div style="{{">
                </div></div>