Skip to content

Commit

Permalink
fix(time-slider): add layer name in right panel mobile device #1494
Browse files Browse the repository at this point in the history
  • Loading branch information
kaminderpal committed Nov 15, 2023
1 parent 890530c commit 072ec05
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ReactNode } from 'react';
import { GridProps } from '@mui/material';
import { GridProps, SxProps } from '@mui/material';
import { useTheme } from '@mui/material/styles';
import { Grid } from '@/ui';

Expand All @@ -10,6 +10,7 @@ interface ResponsiveGridProps extends GridProps {
interface ResponsiveGridPanelProps extends GridProps {
children: ReactNode;
isLayersPanelVisible: boolean;
sxProps?: SxProps;

Check failure on line 13 in packages/geoview-core/src/core/components/common/responsive-grid.tsx

View workflow job for this annotation

GitHub Actions / Build demo files / build-geoview

propType "sxProps" is not required, but has no corresponding defaultProps declaration

Check failure on line 13 in packages/geoview-core/src/core/components/common/responsive-grid.tsx

View workflow job for this annotation

GitHub Actions / Build demo files / build-geoview

propType "sxProps" is not required, but has no corresponding defaultProps declaration
}

/**
Expand Down Expand Up @@ -53,15 +54,16 @@ function ResponsiveGridLeftPanel({ children, isLayersPanelVisible = false, ...re
* @param {boolean} isLayersPanelVisible panel visibility
* @returns JSX.Element
*/
function ResponsiveGridRightPanel({ children, isLayersPanelVisible = false, ...rest }: ResponsiveGridPanelProps) {
function ResponsiveGridRightPanel({ children, isLayersPanelVisible = false, sxProps = {}, ...rest }: ResponsiveGridPanelProps) {
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' },
[theme.breakpoints.down('md')]: { display: !isLayersPanelVisible ? 'block' : 'none' },
...sxProps,
}}
{...rest}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,28 @@ export function Datapanel({ layerData, mapId, projectionConfig, language }: Data
return (
<Box sx={sxClasses.dataPanel}>
<ResponsiveGrid.Root spacing={2} sx={sxClasses.gridContainer}>
<ResponsiveGrid.Left xs={isLayersPanelVisible ? 12 : 0} md={3} isLayersPanelVisible={isLayersPanelVisible}>
<ResponsiveGrid.Left xs={isLayersPanelVisible ? 12 : 0} md={4} isLayersPanelVisible={isLayersPanelVisible}>
<Typography component="p" sx={sxClasses.headline}>
{t('dataTable.leftPanelHeading')}
</Typography>
</ResponsiveGrid.Left>
<ResponsiveGrid.Right
xs={!isLayersPanelVisible ? 12 : 0}
md={9}
sx={{ display: 'flex', justifyContent: 'right' }}
isLayersPanelVisible={isLayersPanelVisible}
>
<EnlargeButton isEnlargeDataTable={isEnlargeDataTable} setIsEnlargeDataTable={setIsEnlargeDataTable} />
{!isLoading && <CloseButton setIsLayersPanelVisible={setIsLayersPanelVisible} isLayersPanelVisible={isLayersPanelVisible} />}
<ResponsiveGrid.Right xs={!isLayersPanelVisible ? 12 : 0} md={8} isLayersPanelVisible={isLayersPanelVisible}>
<Box
sx={{
display: 'flex',
alignItems: 'center',
[theme.breakpoints.up('md')]: { justifyContent: 'right' },
[theme.breakpoints.down('md')]: { justifyContent: 'space-between' },
}}
>
<Box sx={{ [theme.breakpoints.up('md')]: { display: 'none' } }}>
{!isLoading && <Typography component="span">{layerData![selectedLayerIndex]?.layerName![language] ?? ''}</Typography>}
</Box>
<Box>
<EnlargeButton isEnlargeDataTable={isEnlargeDataTable} setIsEnlargeDataTable={setIsEnlargeDataTable} />
{!isLoading && <CloseButton setIsLayersPanelVisible={setIsLayersPanelVisible} isLayersPanelVisible={isLayersPanelVisible} />}
</Box>
</Box>
</ResponsiveGrid.Right>
</ResponsiveGrid.Root>
<ResponsiveGrid.Root sx={{ marginTop: '0.75rem' }}>
Expand All @@ -117,6 +126,7 @@ export function Datapanel({ layerData, mapId, projectionConfig, language }: Data
xs={!isLayersPanelVisible ? 12 : 0}
md={!isEnlargeDataTable ? 8 : 10.75}
isLayersPanelVisible={isLayersPanelVisible}
sxProps={{ minHeight: '250px' }}
>
<CircularProgress
isLoaded={!isLoading}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,28 @@ export function Detailspanel({ mapId }: DetailsPanelProps): JSX.Element {
{layerDataInfo && (
<>
<ResponsiveGrid.Root>
<ResponsiveGrid.Left xs={isLayersPanelVisible ? 12 : 0} md={3} isLayersPanelVisible={isLayersPanelVisible}>
<ResponsiveGrid.Left xs={isLayersPanelVisible ? 12 : 0} md={4} isLayersPanelVisible={isLayersPanelVisible}>
<Typography component="div" sx={sxClasses.panelHeaders}>
{t('details.availableLayers')}
</Typography>
</ResponsiveGrid.Left>
<ResponsiveGrid.Right
isLayersPanelVisible={false}
xs={!isLayersPanelVisible ? 12 : 0}
md={9}
sx={{ display: 'flex', justifyContent: 'right' }}
>
<EnlargeButton isEnlargeDataTable={isEnlargeDataTable} setIsEnlargeDataTable={setIsEnlargeDataTable} />
<CloseButton isLayersPanelVisible={isLayersPanelVisible} setIsLayersPanelVisible={setIsLayersPanelVisible} />
<ResponsiveGrid.Right isLayersPanelVisible={isLayersPanelVisible} xs={!isLayersPanelVisible ? 12 : 0} md={8}>
<Box
sx={{
display: 'flex',
alignItems: 'center',
[theme.breakpoints.up('md')]: { justifyContent: 'right' },
[theme.breakpoints.down('md')]: { justifyContent: 'space-between' },
}}
>
<Box sx={{ [theme.breakpoints.up('md')]: { display: 'none' } }}>
<Typography component="span">{layerDataInfo.layerName}</Typography>
</Box>
<Box>
<EnlargeButton isEnlargeDataTable={isEnlargeDataTable} setIsEnlargeDataTable={setIsEnlargeDataTable} />
<CloseButton isLayersPanelVisible={isLayersPanelVisible} setIsLayersPanelVisible={setIsLayersPanelVisible} />
</Box>
</Box>
</ResponsiveGrid.Right>
</ResponsiveGrid.Root>
<ResponsiveGrid.Root sx={{ marginTop: '1rem' }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,28 @@ export function TimeSliderPanel(props: TypeTimeSliderProps): JSX.Element {
return (
<Box sx={sxClasses.detailsContainer}>
<ResponsiveGrid.Root>
<ResponsiveGrid.Left xs={isLayersPanelVisible ? 12 : 0} md={3} isLayersPanelVisible={isLayersPanelVisible}>
<ResponsiveGrid.Left xs={isLayersPanelVisible ? 12 : 0} md={4} isLayersPanelVisible={isLayersPanelVisible}>
<Typography component="p" sx={sxClasses.panelHeaders}>
{t('details.availableLayers')}
</Typography>
</ResponsiveGrid.Left>
<ResponsiveGrid.Right
isLayersPanelVisible={false}
xs={!isLayersPanelVisible ? 12 : 0}
md={9}
sx={{ display: 'flex', justifyContent: 'right' }}
>
<EnlargeButton isEnlargeDataTable={isEnlargeDataTable} setIsEnlargeDataTable={setIsEnlargeDataTable} />
<CloseButton isLayersPanelVisible={isLayersPanelVisible} setIsLayersPanelVisible={setIsLayersPanelVisible} />
<ResponsiveGrid.Right isLayersPanelVisible={isLayersPanelVisible} xs={!isLayersPanelVisible ? 12 : 0} md={8}>
<Box
sx={{
display: 'flex',
alignItems: 'center',
[theme.breakpoints.up('md')]: { justifyContent: 'right' },
[theme.breakpoints.down('md')]: { justifyContent: 'space-between' },
}}
>
<Box sx={{ [theme.breakpoints.up('md')]: { display: 'none' } }}>
<Typography component="span">{selectedLayer}</Typography>
</Box>
<Box>
<EnlargeButton isEnlargeDataTable={isEnlargeDataTable} setIsEnlargeDataTable={setIsEnlargeDataTable} />
<CloseButton isLayersPanelVisible={isLayersPanelVisible} setIsLayersPanelVisible={setIsLayersPanelVisible} />
</Box>
</Box>
</ResponsiveGrid.Right>
</ResponsiveGrid.Root>
<ResponsiveGrid.Root sx={{ marginTop: '1rem' }}>
Expand Down

0 comments on commit 072ec05

Please sign in to comment.