All files / dnd-list styled-components.js

94.44% Statements 17/18
69.23% Branches 18/26
83.33% Functions 5/6
93.75% Lines 15/16

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115                          3x 2x       3x   3x 2x         3x   3x     4x                                                                                                 3x   4x           3x   3x                                 3x   3x       3x  
/*
Copyright (c) 2018-2019 Uber Technologies, Inc.
 
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
// @flow
import {styled} from '../styles/index.js';
import type {SharedStylePropsArgT} from './types.js';
 
/**
 * Main component container element
 */
export const Root = styled<SharedStylePropsArgT>('div', ({$theme}) => {
  return {
    width: '100%',
  };
});
Root.displayName = 'StyledRoot';
 
export const List = styled<SharedStylePropsArgT>('ul', ({$isDragged}) => {
  return ({
    paddingLeft: 0,
    cursor: $isDragged ? 'grabbing' : null,
  }: {});
});
List.displayName = 'StyledList';
 
export const Item = styled<SharedStylePropsArgT>(
  'li',
  ({$isDragged, $isSelected, $theme}) => {
    return ({
      ':hover':
        !$isDragged && !$isSelected
          ? {
              borderTopWidth: '2px',
              borderBottomWidth: '2px',
              borderLeftWidth: '2px',
              borderRightWidth: '2px',
              borderTopStyle: 'solid',
              borderBottomStyle: 'solid',
              borderLeftStyle: 'solid',
              borderRightStyle: 'solid',
              borderTopColor: $theme.colors.primary,
              borderBottomColor: $theme.colors.primary,
              borderLeftColor: $theme.colors.primary,
              borderRightColor: $theme.colors.primary,
            }
          : {},
      paddingTop: $theme.sizing.scale600,
      paddingBottom: $theme.sizing.scale600,
      paddingLeft: $theme.sizing.scale600,
      paddingRight: $theme.sizing.scale600,
      color: $theme.colors.colorPrimary,
      display: 'flex',
      justifyContent: 'space-between',
      alignItems: 'center',
      listStyle: 'none',
      cursor: $isDragged ? 'grabbing' : 'grab',
      backgroundColor: $theme.colors.backgroundAlt,
      boxShadow: $isDragged ? '0 2px 6px rgba(39, 110, 241, 0.32)' : null,
      borderTopWidth: '2px',
      borderBottomWidth: '2px',
      borderLeftWidth: '2px',
      borderRightWidth: '2px',
      borderTopStyle: 'solid',
      borderBottomStyle: 'solid',
      borderLeftStyle: 'solid',
      borderRightStyle: 'solid',
      borderTopColor:
        $isDragged || $isSelected ? $theme.colors.primary : 'transparent',
      borderBottomColor:
        $isDragged || $isSelected ? $theme.colors.primary : 'transparent',
      borderLeftColor:
        $isDragged || $isSelected ? $theme.colors.primary : 'transparent',
      borderRightColor:
        $isDragged || $isSelected ? $theme.colors.primary : 'transparent',
    }: {});
  },
);
List.displayName = 'StyledItem';
 
export const DragHandle = styled<SharedStylePropsArgT>('div', ({$theme}) => ({
  marginRight: $theme.sizing.scale600,
  width: $theme.sizing.scale800,
  display: 'flex',
  alignItems: 'center',
}));
DragHandle.displayName = 'StyledDragHandle';
 
export const CloseHandle = styled<SharedStylePropsArgT>(
  'button',
  ({$theme}) => ({
    border: 'none',
    paddingTop: 0,
    paddingBottom: 0,
    paddingLeft: 0,
    paddingRight: 0,
    overflow: 'visible',
    cursor: 'pointer',
    backgroundColor: 'transparent',
    marginLeft: $theme.sizing.scale600,
    width: $theme.sizing.scale800,
    display: 'flex',
    alignItems: 'center',
  }),
);
CloseHandle.displayName = 'StyledCloseHandle';
 
export const Label = styled<SharedStylePropsArgT>('div', ({$theme}) => ({
  flexGrow: 1,
  ...$theme.typography.font400,
}));
Label.displayName = 'StyledLabel';