From 066264f14d43ad69af9f3b9c174fae13c74ba995 Mon Sep 17 00:00:00 2001 From: m-tartari <37861893+m-tartari@users.noreply.github.com> Date: Wed, 18 Feb 2026 12:00:56 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20add=20section=20component?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/atoms/SectionHeader/index.tsx | 2 +- src/components/molecules/Section/index.tsx | 129 +++++++++++++++++++ 2 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 src/components/molecules/Section/index.tsx diff --git a/src/components/atoms/SectionHeader/index.tsx b/src/components/atoms/SectionHeader/index.tsx index 5bfcbc5..0bfaba0 100644 --- a/src/components/atoms/SectionHeader/index.tsx +++ b/src/components/atoms/SectionHeader/index.tsx @@ -1,6 +1,6 @@ import { Typography, TypographyProps } from '@mui/material' import { FC } from 'react' -const Header: FC = props => +const Header: FC = props => export default Header diff --git a/src/components/molecules/Section/index.tsx b/src/components/molecules/Section/index.tsx new file mode 100644 index 0000000..c506716 --- /dev/null +++ b/src/components/molecules/Section/index.tsx @@ -0,0 +1,129 @@ +import React from 'react' +import { Box, BoxProps, Typography } from '@mui/material' + +import SectionHeader from 'components/atoms/SectionHeader/index.js' + +interface SectionProps extends BoxProps { + variant?: 'primary' | 'secondary' + title?: string + headline?: string + imageUrl?: string + imageAlt?: string + imageCaption?: React.ReactNode + children?: React.ReactNode +} + +const Section: React.FC = ({ variant = 'primary', imageUrl, imageAlt, imageCaption, children, ...props }) => { + return ( + + theme.breakpoints.values.lg, + ...props.sx, + }}> + {props.title && ( + ({ + paddingBottom: 3, + [theme.breakpoints.up('md')]: { + width: '90em', + maxWidth: 'calc(100% - 2em)', + mx: 'auto', + }, + }), + theme => + theme.applyStyles('dark', { + paddingBottom: 3, + [theme.breakpoints.up('md')]: { + width: '90em', + maxWidth: 'calc(100% - 2em)', + mx: 'auto', + }, + }), + ]}> + {props.title} + + )} + {props.headline && ( + ({ + paddingBottom: 3, + [theme.breakpoints.up('md')]: { + width: '90em', + maxWidth: 'calc(100% - 4em)', + mx: 'auto', + }, + })}> + {props.headline} + + )} + ({ + display: 'flex', + justifyContent: 'center', + + [theme.breakpoints.down('md')]: { + minHeight: '60vh', + flexDirection: props.title || props.headline ? 'column' : 'column-reverse', + alignItems: 'align-items', + gap: 3, + }, + + [theme.breakpoints.up('md')]: { + mx: 'auto', + width: '90em', + maxWidth: 'calc(100% - 4em)', + flexDirection: variant === 'primary' ? 'row-reverse' : 'row', + alignItems: 'center', + gap: 5, + }, + })}> + {imageUrl && + (imageCaption ? ( + + + {imageCaption} + + ) : ( + + ))} + + {children} + + + + + ) +} + +export default Section