Skip to content

Commit

Permalink
Merge pull request #320 from aditya-kumawat/fix-table
Browse files Browse the repository at this point in the history
fix(Grid): minor fixes #312
  • Loading branch information
satyamyadav committed Sep 1, 2020
2 parents b1a0e9b + b3fbd1d commit 932d4a8
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion core/components/organisms/grid/Cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ export const Cell = (props: CellProps) => {

const {
width,
minWidth = 100,
minWidth = 48,
maxWidth = 800
} = getCellSize(cellType);

Expand Down
15 changes: 11 additions & 4 deletions core/components/organisms/grid/MainGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export const MainGrid = (props: MainGridProps) => {
showHead,
draggable,
withCheckbox,
data
data,
page
} = _this.props;

const classes = classNames({
Expand All @@ -36,17 +37,23 @@ export const MainGrid = (props: MainGridProps) => {
}, className);

const minRowHeight: Record<GridSize, number> = {
comfortable: 54,
comfortable: 40,
standard: 40,
compressed: 32,
tight: 24
};

const [state, setState] = React.useState({
const initialState = {
offset: 0,
avgRowHeight: minRowHeight[size],
inView: 20
});
};

const [state, setState] = React.useState(initialState);

React.useEffect(() => {
setState(initialState);
}, [page]);

const {
offset,
Expand Down
16 changes: 7 additions & 9 deletions core/components/organisms/grid/columnUtility.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,27 +71,25 @@ export function getWidth(this: Grid, width: React.ReactText) {
export function getCellSize(cellType: CellType) {
const sizes: Record<CellType, any> = {
AVATAR: {
width: 50,
minWidth: 50
width: 48,
},
AVATAR_WITH_TEXT: {
width: 250,
width: 256,
},
AVATAR_WITH_META_LIST: {
width: 250,
width: 256,
},
ICON: {
width: 50,
minWidth: 50
width: 48,
},
STATUS_HINT: {
width: 100,
width: 96,
},
WITH_META_LIST: {
width: 200,
width: 176,
},
DEFAULT: {
width: 200,
width: 176,
},
};

Expand Down
3 changes: 0 additions & 3 deletions css/src/components/grid.css
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@

.Grid-cell {
position: relative;
overflow: hidden;
box-sizing: border-box;
padding-left: var(--spacing-l);
padding-right: var(--spacing-l);
Expand Down Expand Up @@ -232,7 +231,6 @@
flex-grow: 1;
height: 100%;
box-sizing: border-box;
overflow: hidden;
}

.Grid-cellResize {
Expand Down Expand Up @@ -296,7 +294,6 @@
align-items: center;
width: 100%;
box-sizing: border-box;
overflow: hidden;
}

.GridCell--align-left {
Expand Down

0 comments on commit 932d4a8

Please sign in to comment.