All files / splittable splittable.classNames.ts

80% Statements 4/5
0% Branches 0/18
0% Functions 0/1
100% Lines 4/4
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 521x   1x           1x                                                                                   1x  
import { mergeStyleSets } from '@uifabric/merge-styles';
 
const classNames = {
  root: 'splittable-root',
  divider: 'splittable-divider',
  part: 'splittable-part'
};
 
const splittableClassNames = (orientation: 'vertical' | 'horizontal'): { [key: string]: string } => mergeStyleSets(<any>{
  root: [
    classNames.root,
    {
      display: 'flex',
      flexWrap: 'no-wrap',
      flexDirection: orientation === 'vertical' ? 'row' : 'column',
      selectors: {
        [`.${classNames.part} &`]: {
          width: orientation === 'vertical' ? 'auto' : '100%',
          height: orientation === 'vertical' ? '100%' : 'auto'
        }
      }
    }],
  divider: [
    classNames.divider,
    {
      cursor: orientation === 'vertical' ? 'ew-resize' : 'ns-resize',
      borderStyle: 'solid',
      width: orientation === 'vertical' ? 5 : 'auto',
      height: orientation === 'vertical' ? 'auto' : 5,
      background: 'lightgray',
      boxSizing: 'border-box',
      borderWidth: orientation === 'vertical' ? '0px 2px' : '2px 0px',
      borderColor: 'white',
      selectors: {
        ':hover': {
          borderColor: 'lightgray'
        },
        [`.${classNames.part} & `]: {
          margin: orientation === 'vertical' ? '-12px 0' : '0 -12px'
        }
      }
    }],
  part: [
    classNames.part,
    {
      overflow: 'hidden',
      padding: orientation === 'vertical' ? '0 12px' : '12px 0'
    }]
});
 
export default splittableClassNames;