MCPcopy
hub / github.com/tomkp/react-split-pane / Divider

Function Divider

src/components/Divider.tsx:39–114  ·  view source on GitHub ↗
(props: DividerProps)

Source from the content-addressed store, hash-verified

37 * ```
38 */
39export function Divider(props: DividerProps) {
40 const {
41 direction,
42 index,
43 isDragging,
44 disabled,
45 onPointerDown,
46 onKeyDown,
47 className,
48 style,
49 currentSize,
50 minSize,
51 maxSize,
52 children,
53 } = props;
54
55 const orientation = direction === 'horizontal' ? 'vertical' : 'horizontal';
56
57 const defaultStyle: CSSProperties = {
58 flex: 'none',
59 position: 'relative',
60 userSelect: 'none',
61 touchAction: 'none',
62 ...(direction === 'horizontal'
63 ? {
64 width: '1px',
65 cursor: disabled ? 'default' : 'col-resize',
66 }
67 : {
68 height: '1px',
69 cursor: disabled ? 'default' : 'row-resize',
70 }),
71 ...(isDragging && {
72 cursor: direction === 'horizontal' ? 'col-resize' : 'row-resize',
73 }),
74 };
75
76 const combinedStyle: CSSProperties = {
77 ...defaultStyle,
78 ...style,
79 };
80
81 const combinedClassName = cn(
82 DEFAULT_CLASSNAME,
83 direction,
84 isDragging && 'dragging',
85 className
86 );
87
88 const label = getDividerLabel(index, direction);
89 const instructions = getKeyboardInstructions(direction);
90
91 // Don't pass Infinity to ARIA attributes - screen readers can't handle it
92 const ariaValueMax =
93 maxSize === undefined || maxSize === Infinity ? undefined : maxSize;
94
95 return (
96 <div

Callers

nothing calls this directly

Calls 3

cnFunction · 0.90
getDividerLabelFunction · 0.90
getKeyboardInstructionsFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…