---
import type { HTMLAttributes } from 'astro/types';
const sizes = {
xxl: 'h1',
xl: 'h2',
lg: 'h2',
md: 'h3',
sm: 'h4',
xs: 'h5',
xxs: 'h6',
};
type Headers = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
interface Props extends HTMLAttributes {
size?: keyof typeof sizes
align?: 'left' | 'center' | 'right' | 'inherit'
}
const {
size = 'lg',
align = 'inherit',
...attr
} = Astro.props;
const Element = sizes[size] as any; // Unfortunately gotta do this
let className: string | string[] = [];
if (align !== 'inherit')
className.push(`text-${align}`);
if (size === 'xxl' || size === 'xl')
className.push('page-header');
if (attr.class)
className.push(attr.class);
className = className.join(' ');
---