import styles from "./styles.module.scss";
import classNames from 'classnames'
import { faustina } from '@/app/fonts'

type TitleProps = {
  title: string;
  subtitle?: string;
  align?: 'left' | 'center';
  size?: 'xl' | 'lg' | 'md' | "sm";
  fontStyle?: 'serif' | 'sans-serif'
  color?: "base" | "contrast" | "white",
  cancelled?: boolean,
}

export const Title = ({title, subtitle, align = "left", size = "lg", fontStyle = "serif", color = "base", cancelled = false}: TitleProps) => {
  return (
    <>
      <h2 className={classNames({
        [styles.title]: true,
        [styles.base]: color === "base",
        [styles.contrast]: color === "contrast",
        [styles.white]: color === "white",
        [styles.extraLarge]: size === "xl",
        [styles.large]: size === "lg",
        [styles.medium]: size === "md",
        [styles.small]: size === "sm",
        [styles.left]: align === "left",
        [styles.center]: align === "center",
        [faustina.className]: fontStyle == "serif",
        [styles.cancelled]: cancelled
      })}>{title}</h2>
      {subtitle &&
        <div className={classNames({
          [styles.subtitle]: true,
          [styles.base]: color === "contrast",
          [styles.contrast]: color === "base",
          [styles.white]: color === "white",
          [styles.small]: true,
          [styles.left]: align === "left",
          [styles.center]: align === "center",
          [faustina.className]: fontStyle == "sans-serif"
        })}>
          {subtitle}
        </div>
      }
    </>
  )
}