AbiirSkincare/Hydrogen/web/app/components/PageTitle.tsx

32 lines
832 B
TypeScript

import type {HTMLAttributes} from 'react';
import {
PAGE_TITLE_DEFAULT_TEXT_CLASS,
PAGE_TITLE_TYPOGRAPHY_CLASS,
} from '~/lib/pageTitle';
type PageTitleProps = {
as?: 'h1' | 'h2';
className?: string;
children: React.ReactNode;
} & HTMLAttributes<HTMLHeadingElement>;
/**
* Main page / prime section title — typography matches homepage `Testimonials` heading.
* Pass extra `className` for layout (e.g. `text-center max-w-[1298px]`). Override default charcoal with `className` or `style` when needed (hero on image, CMS).
*/
export function PageTitle({
as: Tag = 'h1',
className = '',
children,
...rest
}: PageTitleProps) {
return (
<Tag
className={`m-0 ${PAGE_TITLE_TYPOGRAPHY_CLASS} ${PAGE_TITLE_DEFAULT_TEXT_CLASS} ${className}`.trim()}
{...rest}
>
{children}
</Tag>
);
}