Files
9b68c03c-1b5a-4ba5-a741-331…/src/components/sections/about/TextAbout.tsx
vitalijmulika 4ef6fdd36a Initial commit
2025-12-25 13:52:13 +02:00

66 lines
2.2 KiB
TypeScript

"use client";
import React, { memo } from "react";
import TextAnimation from "@/components/text/TextAnimation";
import Button from "@/components/button/Button";
import { cls } from "@/lib/utils";
import { getButtonProps } from "@/lib/buttonUtils";
import { useTheme } from "@/providers/themeProvider/ThemeProvider";
import type { ButtonConfig } from "@/types/button";
interface TextAboutProps {
title: string;
buttons?: ButtonConfig[];
useInvertedBackground: "noInvert" | "invertDefault" | "invertCard";
ariaLabel?: string;
className?: string;
containerClassName?: string;
titleClassName?: string;
buttonContainerClassName?: string;
buttonClassName?: string;
buttonTextClassName?: string;
}
const TextAbout = ({
title,
buttons,
useInvertedBackground,
ariaLabel = "About section",
className = "",
containerClassName = "",
titleClassName = "",
buttonContainerClassName = "",
buttonClassName = "",
buttonTextClassName = "",
}: TextAboutProps) => {
const theme = useTheme();
return (
<section
aria-label={ariaLabel}
className={cls("relative py-20", useInvertedBackground === "invertCard" ? "w-content-width-expanded mx-auto rounded-theme-capped bg-foreground" : "w-full", useInvertedBackground === "invertDefault" && "bg-foreground", className)}
>
<div className={cls("w-content-width mx-auto flex flex-col gap-6 items-center", containerClassName)}>
<TextAnimation
type={theme.defaultTextAnimation}
text={title}
variant="words-trigger"
className={cls("text-2xl md:text-5xl font-medium text-center leading-[1.175]", (useInvertedBackground === "invertDefault" || useInvertedBackground === "invertCard") && "text-background", titleClassName)}
/>
{buttons && buttons.length > 0 && (
<div className={cls("flex gap-4", buttonContainerClassName)}>
{buttons.slice(0, 2).map((button, index) => (
<Button key={index} {...getButtonProps(button, index, theme.defaultButtonVariant, cls("px-8", buttonClassName), cls("text-base", buttonTextClassName))} />
))}
</div>
)}
</div>
</section>
);
};
TextAbout.displayName = "TextAbout";
export default memo(TextAbout);