import React, { CSSProperties } from 'react' import Container, { ContainerProps } from '@mui/material/Container' import { LmComponentRender } from '@LmComponentRender' import BackgroundImage from './BackgroundImage' import BackgroundElements from './BackgroundElements' import useBackgroundBox from './useBackgroundBox' import { LmSectionProps } from './sectionTypes' import { BackgroundStoryblok } from '../../typings/generated/components-schema' import { useFormColorStyles } from '../../utils/jss/formColorStyles' import { makeStyles } from 'tss-react/mui' const useStyles = makeStyles({ name: 'Section' })({ fullHeight: { width: '100%', height: '100%', minHeight: '100vh', '& .lm-grid-row__wrap': { minHeight: 'inherit' }, '& .lm-grid-column__wrap': { height: '100%' } }, background: { position: 'relative', '& .MuiGrid2-root': { position: 'relative' } } }) export function LmSection({ content, sectionPosition }: LmSectionProps): JSX.Element { const { classes, cx: clsx, theme } = useStyles() const classesForms = useFormColorStyles().classes const background: BackgroundStoryblok | undefined = content.background?.[0] const { style, className } = useBackgroundBox({ variant: content.variant || content.presetVariant, background, styles: content.styles, stylesMobile: content.styles_mobile, stylesTablet: content.styles_tablet, stylesHover: content.styles_hover }) const body = content.body || [] const containerStyles: CSSProperties = {} const isFullHeight = !!( content.property && content.property.includes('is_full_height') ) if (!isFullHeight) { const splittedPadding = content.padding?.split(' ') || [] if (splittedPadding.length > 2) { containerStyles.padding = content.padding } containerStyles.paddingTop = splittedPadding[0] || '2.5rem' containerStyles.paddingBottom = splittedPadding[0] || '2.5rem' } const maxWidth = content.max_width ? content.max_width === 'none' ? false : content.max_width : theme.defaultContainerWidth // todo className doubled used return (