# All files / components/DragList DragList.js

0% Statements 0/41
0% Branches 0/6
0% Functions 0/4
0% Lines 0/11

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35

     import React from 'react';
    import PropTypes from 'prop-types';
    import get from 'extensions/themeGet';
    import styled from 'styled-components';
    import DragListItem from './DragListItem';
    import DragContainer from 'components/DragContainer';

    const StyledDiv = styled.div`
      & > * + * {
        margin-top: ${get('spacing.medium')};
      }
    `;

    /**
     * A list of items that can be dragged and reordered.
     * Use a list of [DragList.Item](/#!/DragListItem) as children.
     * [DragList.Container](/#!/DragContainer) is provided
     * as a convenient way to display items in the drag list.
     */
    class DragList extends React.PureComponent {
      static Item = DragListItem;
      static Container = DragContainer;

      static propTypes = {
        children: PropTypes.node.isRequired,
      };

      render() {
        const {children, ...rest} = this.props;
        return <StyledDiv {...rest}>{children}</StyledDiv>;
      }
    }

    export default DragList;