diff --git a/packages/geoview-core/src/core/components/common/index.ts b/packages/geoview-core/src/core/components/common/index.ts index a2285c1f8f9..2d2102bb812 100644 --- a/packages/geoview-core/src/core/components/common/index.ts +++ b/packages/geoview-core/src/core/components/common/index.ts @@ -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'; diff --git a/packages/geoview-core/src/core/components/common/layer-title.tsx b/packages/geoview-core/src/core/components/common/layer-title.tsx deleted file mode 100644 index d948447cfa0..00000000000 --- a/packages/geoview-core/src/core/components/common/layer-title.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { useTheme } from '@mui/material'; -import { Typography } from '@/ui'; - -interface LayerTitleProp { - children: React.ReactNode; - hideTitle?: boolean; - fullWidth?: boolean; -} - -/** - * Create Layer Title. - * @param {string} children the name of the layer. - * @param {boolean} hideTitle hide the layer title for desktop view. - * @param {boolean} fullWidth show and hide title when width of container is maximum. - * @returns {JSX.Element} - */ -export function LayerTitle({ children, hideTitle, fullWidth }: LayerTitleProp): JSX.Element { - const theme = useTheme(); - - return ( - - {children} - - ); -} diff --git a/packages/geoview-core/src/core/components/common/layout.tsx b/packages/geoview-core/src/core/components/common/layout.tsx index 26b4fb19ff3..95f448e8167 100644 --- a/packages/geoview-core/src/core/components/common/layout.tsx +++ b/packages/geoview-core/src/core/components/common/layout.tsx @@ -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; @@ -26,6 +27,7 @@ export function Layout({ onGuideIsOpen, }: LayoutProps): JSX.Element { const responsiveLayoutRef = useRef(null); + const theme = useTheme(); /** * Handles clicks to layers in left panel. Sets selected layer. @@ -65,10 +67,26 @@ export function Layout({ * @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 ( - - {memoLayerTitle} - + + + {memoLayerTitle} + + ); }, [fullWidth, memoLayerTitle]); diff --git a/packages/geoview-core/src/core/components/common/responsive-grid-layout-style.ts b/packages/geoview-core/src/core/components/common/responsive-grid-layout-style.ts index 093d93f0dea..444b9370256 100644 --- a/packages/geoview-core/src/core/components/common/responsive-grid-layout-style.ts +++ b/packages/geoview-core/src/core/components/common/responsive-grid-layout-style.ts @@ -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', diff --git a/packages/geoview-core/src/core/components/common/responsive-grid-layout.tsx b/packages/geoview-core/src/core/components/common/responsive-grid-layout.tsx index e05b1514d9e..967db612832 100644 --- a/packages/geoview-core/src/core/components/common/responsive-grid-layout.tsx +++ b/packages/geoview-core/src/core/components/common/responsive-grid-layout.tsx @@ -126,7 +126,7 @@ const ResponsiveGridLayout = forwardRef( variant="contained" className="style2" startIcon={isEnlarged ? : } - 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" @@ -261,7 +261,7 @@ const ResponsiveGridLayout = forwardRef( return ( - + {!fullWidth && ( {rightTop ?? } - + {!fullWidth && !hideEnlargeBtn && renderEnlargeButton()} {!!guideContentIds?.length && renderGuideButton()} {!isMapFullScreen && renderFullScreenButton()}