2023-10-18 16:21:15 +03:00
|
|
|
import { cn } from "@/lib/utils";
|
|
|
|
|
2023-10-17 11:57:27 +03:00
|
|
|
import styles from "./HomeSection.module.css";
|
|
|
|
|
|
|
|
type HomeSectionProps = {
|
|
|
|
bg: string;
|
|
|
|
slantCurrent?: "up" | "down" | "none";
|
|
|
|
slantBefore?: "up" | "down" | "none";
|
|
|
|
slantAfter?: "up" | "down" | "none";
|
2023-10-19 18:53:00 +03:00
|
|
|
gradient?: string;
|
2023-10-17 11:57:27 +03:00
|
|
|
hiddenOnMobile?: boolean;
|
|
|
|
children: React.ReactNode;
|
2023-10-18 16:21:15 +03:00
|
|
|
className?: string;
|
2023-10-17 11:57:27 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
export const HomeSection = ({
|
|
|
|
bg,
|
|
|
|
slantCurrent = "none",
|
|
|
|
slantBefore = "none",
|
|
|
|
slantAfter = "none",
|
2023-10-19 18:53:00 +03:00
|
|
|
gradient,
|
2023-10-17 11:57:27 +03:00
|
|
|
hiddenOnMobile = false,
|
2023-10-18 16:21:15 +03:00
|
|
|
className,
|
2023-10-17 11:57:27 +03:00
|
|
|
children,
|
|
|
|
}: HomeSectionProps): JSX.Element => {
|
|
|
|
const slantBeforeFix = styles[`slant-before-is-${slantBefore}`] ?? "";
|
|
|
|
const slantAfterFix = styles[`slant-after-is-${slantAfter}`] ?? "";
|
|
|
|
const flex = hiddenOnMobile
|
|
|
|
? "hidden md:flex md:justify-center"
|
|
|
|
: "flex justify-center";
|
|
|
|
const slant = styles[`section-slanted-${slantCurrent}wards`] ?? "";
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div
|
2023-10-18 16:21:15 +03:00
|
|
|
className={cn(
|
2023-10-23 12:29:51 +03:00
|
|
|
`${bg} w-screen ${flex} ${slantBeforeFix} ${slantAfterFix} ${slant} overflow-hidden`,
|
2023-10-18 16:21:15 +03:00
|
|
|
className
|
|
|
|
)}
|
2023-10-17 11:57:27 +03:00
|
|
|
>
|
2023-10-18 16:21:15 +03:00
|
|
|
<section className="flex flex-col items-center w-full max-w-6xl z-[2] py-8">
|
2023-10-17 11:57:27 +03:00
|
|
|
{children}
|
|
|
|
</section>
|
2023-10-19 18:53:00 +03:00
|
|
|
{gradient !== undefined ? (
|
|
|
|
<div
|
|
|
|
className={`absolute w-screen bottom-[calc(100vw*tan(6deg))] left-0 h-[30%] ${gradient}`}
|
|
|
|
/>
|
|
|
|
) : null}
|
2023-10-17 11:57:27 +03:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|