2023-10-23 23:11:59 +02:00
|
|
|
import { ShadowContainer } from "@/components/design/ShadowContainer"
|
|
|
|
import { SectionHeading } from "@/components/design/Section/SectionHeading"
|
2021-04-18 01:56:23 +02:00
|
|
|
|
2023-10-23 23:11:59 +02:00
|
|
|
type SectionProps = React.ComponentPropsWithRef<"section"> & {
|
2021-04-18 01:56:23 +02:00
|
|
|
heading?: string
|
|
|
|
description?: string
|
|
|
|
isMain?: boolean
|
|
|
|
withoutShadowContainer?: boolean
|
|
|
|
}
|
|
|
|
|
2023-08-01 17:22:09 +02:00
|
|
|
export const Section = (props: SectionProps): JSX.Element => {
|
2021-04-18 01:56:23 +02:00
|
|
|
const {
|
|
|
|
children,
|
|
|
|
heading,
|
|
|
|
description,
|
|
|
|
isMain = false,
|
|
|
|
withoutShadowContainer = false,
|
|
|
|
...rest
|
|
|
|
} = props
|
|
|
|
|
|
|
|
if (isMain) {
|
|
|
|
return (
|
2023-10-23 23:11:59 +02:00
|
|
|
<div className="w-full px-3">
|
2021-05-08 19:52:04 +02:00
|
|
|
<ShadowContainer style={{ marginTop: 50 }}>
|
2021-06-15 20:35:52 +02:00
|
|
|
<section {...rest}>
|
2023-05-21 18:21:46 +02:00
|
|
|
{heading != null ? (
|
|
|
|
<SectionHeading>{heading}</SectionHeading>
|
|
|
|
) : null}
|
2023-10-23 23:11:59 +02:00
|
|
|
<div className="w-full px-3">{children}</div>
|
2021-05-08 19:52:04 +02:00
|
|
|
</section>
|
|
|
|
</ShadowContainer>
|
|
|
|
</div>
|
2021-04-18 01:56:23 +02:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
if (withoutShadowContainer) {
|
|
|
|
return (
|
2021-06-15 20:35:52 +02:00
|
|
|
<section {...rest}>
|
2023-05-21 18:21:46 +02:00
|
|
|
{heading != null ? <SectionHeading>{heading}</SectionHeading> : null}
|
2023-10-23 23:11:59 +02:00
|
|
|
<div className="w-full px-3">{children}</div>
|
2021-04-18 01:56:23 +02:00
|
|
|
</section>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2021-06-15 20:35:52 +02:00
|
|
|
<section {...rest}>
|
2023-05-21 18:21:46 +02:00
|
|
|
{heading != null ? (
|
|
|
|
<SectionHeading
|
|
|
|
style={{ ...(description != null ? { margin: 0 } : {}) }}
|
|
|
|
>
|
2021-04-18 01:56:23 +02:00
|
|
|
{heading}
|
|
|
|
</SectionHeading>
|
2023-05-21 18:21:46 +02:00
|
|
|
) : null}
|
|
|
|
{description != null ? (
|
2023-10-23 23:11:59 +02:00
|
|
|
<p style={{ marginTop: 7 }} className="text-center">
|
2021-04-18 01:56:23 +02:00
|
|
|
{description}
|
|
|
|
</p>
|
2023-05-21 18:21:46 +02:00
|
|
|
) : null}
|
2023-10-23 23:11:59 +02:00
|
|
|
<div className="w-full px-3">
|
2021-05-08 19:52:04 +02:00
|
|
|
<ShadowContainer>
|
2023-10-23 23:11:59 +02:00
|
|
|
<div className="w-full px-16 py-4 leading-8">{children}</div>
|
2021-05-08 19:52:04 +02:00
|
|
|
</ShadowContainer>
|
|
|
|
</div>
|
2021-04-18 01:56:23 +02:00
|
|
|
</section>
|
|
|
|
)
|
2021-06-15 20:35:52 +02:00
|
|
|
}
|