fix ResourceTable selection cell width

This commit is contained in:
ShinCurry
2019-07-18 20:20:13 +08:00
parent 1ade40381d
commit cf86b1e3bc
3 changed files with 29 additions and 6 deletions

View File

@@ -98,6 +98,23 @@ $breakpoint: 768px;
text-align: left;
transition: background-color 0.2s ease-in-out;
vertical-align: middle;
&.SelectionCell {
padding-left: 1.4rem !important;
padding-right: 0 !important;
width: 46px !important;
}
}
.SelectionCell {
padding: 0;
border-bottom: border-width() solid color('sky', 'light');
white-space: nowrap;
text-align: left;
transition: background-color 0.2s ease-in-out;
vertical-align: middle;
width: 42px !important;
}
.Cell-numeric {

View File

@@ -222,11 +222,13 @@ export class ResourceTable extends React.PureComponent<
}
};
return (
<Checkbox
label=""
checked={selectedIndexes && selectedIndexes.includes(rowIndex)}
onChange={handleOnChange}
/>
<div style={{marginLeft: 17, width: 10}}>
<Checkbox
label=""
checked={selectedIndexes && selectedIndexes.includes(rowIndex)}
onChange={handleOnChange}
/>
</div>
);
};
@@ -782,6 +784,7 @@ export class ResourceTable extends React.PureComponent<
onRowClicked,
selectedIndexes = [],
onDragEnd,
onSelection,
} = this.props;
const {heights} = this.state;
const bodyCellHeights = totals ? heights.slice(2) : heights.slice(1);
@@ -840,6 +843,7 @@ export class ResourceTable extends React.PureComponent<
const id = `cell-${cellIndex}-row-${index}`;
return (
<Cell
isSelection={cellIndex === 0 && Boolean(onSelection)}
key={id}
testID={id}
height={bodyCellHeights[index]}

View File

@@ -28,6 +28,7 @@ export interface Props {
event: React.MouseEvent<HTMLTableDataCellElement, MouseEvent>,
) => void;
isDragOccurring?: boolean;
isSelection?: boolean;
}
export type CombinedProps = Props & WithAppProviderProps;
@@ -111,12 +112,13 @@ export class Cell extends React.Component<CombinedProps, State, Snapshot> {
},
onSort,
onClick,
isSelection,
} = this.props;
const numeric = contentType === 'numeric';
const className = classNames(
styles.Cell,
isSelection ? styles.SelectionCell : styles.Cell,
fixed && styles['Cell-fixed'],
fixed && truncate && styles['Cell-truncated'],
header && styles['Cell-header'],