-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1475 from kaminderpal/1462-responsive-datatable
- Loading branch information
Showing
10 changed files
with
194 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
packages/geoview-core/src/core/components/data-table/data-table-grid.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { ReactNode } from 'react'; | ||
import { GridProps } from '@mui/material'; | ||
import { useTheme } from '@mui/material/styles'; | ||
import { Grid } from '@/ui'; | ||
|
||
interface DataTableGridProps extends GridProps { | ||
children: ReactNode; | ||
} | ||
|
||
interface DataTableGridPanelProps extends GridProps { | ||
children: ReactNode; | ||
isLayersPanelVisible: boolean; | ||
} | ||
|
||
/** | ||
* Create Grid Container | ||
* @param {ReactNode} children children to be renderer | ||
* @returns JSX.Element | ||
*/ | ||
function DataTableGridRoot({ children, ...rest }: DataTableGridProps) { | ||
return ( | ||
<Grid container {...rest}> | ||
{children} | ||
</Grid> | ||
); | ||
} | ||
|
||
/** | ||
* Create Left Panel for Data table grid. | ||
* @param {ReactNode} children child elements to be rendered | ||
* @param {boolean} isLayersPanelVisible panel visibility | ||
* @returns JSX.Element | ||
*/ | ||
function DataTableGridLeftPanel({ children, isLayersPanelVisible = false, ...rest }: DataTableGridPanelProps) { | ||
const theme = useTheme(); | ||
|
||
return ( | ||
<Grid | ||
item | ||
sx={{ | ||
[theme.breakpoints.down('md')]: { display: isLayersPanelVisible ? 'block' : 'none' }, | ||
}} | ||
{...rest} | ||
> | ||
{children} | ||
</Grid> | ||
); | ||
} | ||
|
||
/** | ||
* Create Right Panel for Data table grid. | ||
* @param {ReactNode} children child elements to be rendered | ||
* @param {boolean} isLayersPanelVisible panel visibility | ||
* @returns JSX.Element | ||
*/ | ||
function DataTableGridRightPanel({ children, isLayersPanelVisible = false, ...rest }: DataTableGridPanelProps) { | ||
const theme = useTheme(); | ||
return ( | ||
<Grid | ||
item | ||
sx={{ | ||
position: 'relative', | ||
[theme.breakpoints.up('md')]: { paddingLeft: '1rem' }, | ||
[theme.breakpoints.down('md')]: { display: !isLayersPanelVisible ? 'block' : 'none', minHeight: '250px' }, | ||
}} | ||
{...rest} | ||
> | ||
{children} | ||
</Grid> | ||
); | ||
} | ||
|
||
export const DataTableGrid = { | ||
Root: DataTableGridRoot, | ||
Left: DataTableGridLeftPanel, | ||
Right: DataTableGridRightPanel, | ||
}; |
2 changes: 1 addition & 1 deletion
2
packages/geoview-core/src/core/components/data-table/data-table.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/geoview-core/src/core/components/data-table/filter-map.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
packages/geoview-core/src/core/components/data-table/json-export-button.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,6 +141,6 @@ export const getSxClasses = (theme: Theme) => ({ | |
fontSize: 16, | ||
noWrap: true, | ||
marginLeft: 20, | ||
} | ||
} | ||
}, | ||
}, | ||
}); |