Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bg to right buttons #2165

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/geoview-core/src/core/components/common/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export * from './focus-trap-element';
export * from './responsive-grid';
export * from './layer-list';
export * from './layer-title';
export * from './layout';
export * from './use-footer-panel-height';
export * from './use-lightbox';
33 changes: 0 additions & 33 deletions packages/geoview-core/src/core/components/common/layer-title.tsx

This file was deleted.

26 changes: 22 additions & 4 deletions packages/geoview-core/src/core/components/common/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { useCallback, ReactNode, useRef, useMemo } from 'react';
import { useTheme } from '@mui/material/styles';
import { logger } from '@/core/utils/logger';
import { LayerList, LayerListEntry } from './layer-list';
import { ResponsiveGridLayout, ResponsiveGridLayoutExposedMethods } from './responsive-grid-layout';
import { LayerTitle } from './layer-title';
import { Tooltip, Typography } from '@/ui';

interface LayoutProps {
children?: ReactNode;
Expand All @@ -26,6 +27,7 @@
onGuideIsOpen,
}: LayoutProps): JSX.Element {
const responsiveLayoutRef = useRef<ResponsiveGridLayoutExposedMethods>(null);
const theme = useTheme();

/**
* Handles clicks to layers in left panel. Sets selected layer.
Expand Down Expand Up @@ -65,12 +67,28 @@
* @returns JSX.Element
*/
const renderLayerTitle = useCallback((): JSX.Element => {
// clamping code copied from https://tailwindcss.com/docs/line-clamp
const sxClasses = {
fontSize: theme.palette.geoViewFontSize.lg,
textAlign: fullWidth ? 'center' : 'left',
width: fullWidth ? '100%' : 'auto',
fontWeight: '600',
marginTop: '12px',
overflow: 'hidden',
display: '-webkit-box',
'-webkit-box-orient': 'vertical',
'-webkit-line-clamp': '2',
...(!fullWidth && { [theme.breakpoints.up('md')]: { display: 'none' } }),
};

return (
<LayerTitle hideTitle fullWidth={fullWidth}>
{memoLayerTitle}
</LayerTitle>
<Tooltip title={memoLayerTitle} placement="top" arrow>
<Typography sx={sxClasses} component="div">
{memoLayerTitle}
</Typography>
</Tooltip>
);
}, [fullWidth, memoLayerTitle]);

Check warning on line 91 in packages/geoview-core/src/core/components/common/layout.tsx

View workflow job for this annotation

GitHub Actions / Build demo files / build-geoview

React Hook useCallback has missing dependencies: 'theme.breakpoints' and 'theme.palette.geoViewFontSize.lg'. Either include them or remove the dependency array

Check warning on line 91 in packages/geoview-core/src/core/components/common/layout.tsx

View workflow job for this annotation

GitHub Actions / Build demo files / build-geoview

React Hook useCallback has missing dependencies: 'theme.breakpoints' and 'theme.palette.geoViewFontSize.lg'. Either include them or remove the dependency array

return (
<ResponsiveGridLayout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ import { Theme } from '@mui/material/styles';
// ? I doubt we want to define an explicit type for style properties?
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const getSxClasses = (theme: Theme): any => ({
rightButtonsContainer: {
display: 'flex',
flexDirection: 'row',
gap: '0.6rem',
backgroundColor: theme.palette.geoViewColor.primary.lighten(0.5, 0.4),
borderTopLeftRadius: '1.8rem',
borderTopRightRadius: '0.5rem',
padding: ' 0.5rem 0.5rem 0.5rem 2rem',
borderTop: `0.2rem solid ${theme.palette.geoViewColor.primary.lighten(0.2, 0.4)}`,
borderLeft: `0.2rem solid ${theme.palette.geoViewColor.primary.lighten(0.2, 0.4)}`,
},
rightGridContent: {
border: `2px solid ${theme.palette.geoViewColor.primary.main}`,
borderRadius: '5px',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const ResponsiveGridLayout = forwardRef(
variant="contained"
className="style2"
startIcon={isEnlarged ? <ArrowForwardIcon /> : <ArrowBackIcon />}
sx={{ height: '40px', borderRadius: '1.5rem', [theme.breakpoints.down('md')]: { display: 'none' } }}
sx={{ height: '40px', borderRadius: '1.5rem', boxShadow: 'none', [theme.breakpoints.down('md')]: { display: 'none' } }}
onClick={() => handleIsEnlarge(!isEnlarged)}
tooltip={isEnlarged ? t('dataTable.reduceBtn')! : t('dataTable.enlargeBtn')!}
tooltipPlacement="top"
Expand Down Expand Up @@ -261,7 +261,7 @@ const ResponsiveGridLayout = forwardRef(

return (
<Box ref={ref}>
<ResponsiveGrid.Root sx={{ pt: 8, pb: 8 }} ref={panelTitleRef}>
<ResponsiveGrid.Root sx={{ pt: 8, pb: 0 }} ref={panelTitleRef}>
{!fullWidth && (
<ResponsiveGrid.Left
isRightPanelVisible={isRightPanelVisible}
Expand All @@ -284,14 +284,16 @@ const ResponsiveGridLayout = forwardRef(
<Box
sx={{
display: 'flex',
alignItems: 'center',
alignItems: fullWidth ? 'end' : 'center',
flexDirection: fullWidth ? 'column' : 'row',
gap: fullWidth ? '10px' : '0',
[theme.breakpoints.up('md')]: { justifyContent: fullWidth ? 'space-between' : 'right' },
[theme.breakpoints.down('md')]: { justifyContent: 'space-between' },
}}
>
{rightTop ?? <Box />}

<Box sx={{ display: 'flex', flexDirection: 'row', gap: '0.6rem' }}>
<Box sx={sxClasses.rightButtonsContainer}>
{!fullWidth && !hideEnlargeBtn && renderEnlargeButton()}
{!!guideContentIds?.length && renderGuideButton()}
{!isMapFullScreen && renderFullScreenButton()}
Expand Down
Loading