import { ReactNode } from "react";
import Container from "@/components/Container/Container";
import Section from "@/components/Section/Section";
import AnimatedWords from "@/components/AnimatedWords/AnimatedWords";
import { unescapeHtml } from "@/utils/unescapeHtml";

type PageTitleProps = {
  title?: string;
  supporting_title?: string;
  children?: ReactNode;
  anchor?: string;
};

const PageTitleAlt = ({ title = "", ...rest }: PageTitleProps) => {
  return (
    <Container id={rest.anchor}>
      <Section gridArea="thin" className="mb-none">
        {rest.supporting_title && (
          <h1 className="h2">
            <AnimatedWords text={unescapeHtml(rest.supporting_title)} />
          </h1>
        )}
        <h2 className="h1 m-none">
          <AnimatedWords text={unescapeHtml(title)} />
        </h2>
        {rest.children}
      </Section>
    </Container>
  );
};

export default PageTitleAlt;
