11import { forwardRef , memo } from 'react' ;
2- import clsx from 'clsx ' ;
2+ import { css } from '@linaria/core ' ;
33
4- import { cellClassname , cellCopiedClassname , cellDraggedOverClassname , cellDragHandleClassname , cellFrozenClassname , cellFrozenLastClassname , cellSelectedClassname } from './style' ;
5- import { getCellStyle , wrapEvent } from './utils' ;
4+ import { cellSelectedClassname } from './style' ;
5+ import { getCellStyle , getCellClassname , wrapEvent } from './utils' ;
66import type { CellRendererProps } from './types' ;
77
8+ const cellCopied = css `
9+ background-color : # ccccff ;
10+ ` ;
11+
12+ const cellCopiedClassname = `rdg-cell-copied ${ cellCopied } ` ;
13+
14+ const cellDraggedOver = css `
15+ background-color : # ccccff ;
16+
17+ & .${ cellCopied } {
18+ background-color : # 9999ff ;
19+ }
20+ ` ;
21+
22+ const cellDraggedOverClassname = `rdg-cell-dragged-over ${ cellDraggedOver } ` ;
23+
24+ const cellDragHandle = css `
25+ cursor : move;
26+ position : absolute;
27+ right : 0 ;
28+ bottom : 0 ;
29+ width : 8px ;
30+ height : 8px ;
31+ background-color : var (--selection-color );
32+
33+ & : hover {
34+ width : 16px ;
35+ height : 16px ;
36+ border : 2px solid var (--selection-color );
37+ background-color : var (--background-color );
38+ }
39+ ` ;
40+
41+ const cellDragHandleClassname = `rdg-cell-drag-handle ${ cellDragHandle } ` ;
42+
843function Cell < R , SR > ( {
944 className,
1045 column,
@@ -25,11 +60,9 @@ function Cell<R, SR>({
2560 ...props
2661} : CellRendererProps < R , SR > , ref : React . Ref < HTMLDivElement > ) {
2762 const { cellClass } = column ;
28- className = clsx (
29- cellClassname ,
63+ className = getCellClassname (
64+ column ,
3065 {
31- [ cellFrozenClassname ] : column . frozen ,
32- [ cellFrozenLastClassname ] : column . isLastFrozenColumn ,
3366 [ cellSelectedClassname ] : isCellSelected ,
3467 [ cellCopiedClassname ] : isCopied ,
3568 [ cellDraggedOverClassname ] : isDraggedOver
0 commit comments