2026-02-17 12:47:39 +05:30
|
|
|
"use client";
|
|
|
|
|
|
2026-02-20 22:44:56 -08:00
|
|
|
import { cva, type VariantProps } from "class-variance-authority";
|
2026-02-17 12:47:39 +05:30
|
|
|
|
|
|
|
|
import type { PlateElementProps } from "platejs/react";
|
|
|
|
|
import { PlateElement } from "platejs/react";
|
2026-02-20 22:44:56 -08:00
|
|
|
import * as React from "react";
|
2026-02-17 12:47:39 +05:30
|
|
|
|
2026-04-09 17:24:31 +05:30
|
|
|
const headingVariants = cva("relative mb-1 first:mt-0", {
|
2026-02-17 12:47:39 +05:30
|
|
|
variants: {
|
|
|
|
|
variant: {
|
|
|
|
|
h1: "mt-[1.6em] pb-1 font-bold font-heading text-4xl",
|
|
|
|
|
h2: "mt-[1.4em] pb-px font-heading font-semibold text-2xl tracking-tight",
|
|
|
|
|
h3: "mt-[1em] pb-px font-heading font-semibold text-xl tracking-tight",
|
|
|
|
|
h4: "mt-[0.75em] font-heading font-semibold text-lg tracking-tight",
|
|
|
|
|
h5: "mt-[0.75em] font-semibold text-lg tracking-tight",
|
|
|
|
|
h6: "mt-[0.75em] font-semibold text-base tracking-tight",
|
|
|
|
|
},
|
|
|
|
|
},
|
2026-02-16 00:11:34 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export function HeadingElement({
|
2026-02-17 12:47:39 +05:30
|
|
|
variant = "h1",
|
|
|
|
|
...props
|
2026-02-16 00:11:34 +05:30
|
|
|
}: PlateElementProps & VariantProps<typeof headingVariants>) {
|
2026-02-17 12:47:39 +05:30
|
|
|
return (
|
|
|
|
|
<PlateElement as={variant!} className={headingVariants({ variant })} {...props}>
|
|
|
|
|
{props.children}
|
|
|
|
|
</PlateElement>
|
|
|
|
|
);
|
2026-02-16 00:11:34 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function H1Element(props: PlateElementProps) {
|
2026-02-17 12:47:39 +05:30
|
|
|
return <HeadingElement variant="h1" {...props} />;
|
2026-02-16 00:11:34 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function H2Element(props: PlateElementProps) {
|
2026-02-17 12:47:39 +05:30
|
|
|
return <HeadingElement variant="h2" {...props} />;
|
2026-02-16 00:11:34 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function H3Element(props: PlateElementProps) {
|
2026-02-17 12:47:39 +05:30
|
|
|
return <HeadingElement variant="h3" {...props} />;
|
2026-02-16 00:11:34 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function H4Element(props: PlateElementProps) {
|
2026-02-17 12:47:39 +05:30
|
|
|
return <HeadingElement variant="h4" {...props} />;
|
2026-02-16 00:11:34 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function H5Element(props: PlateElementProps) {
|
2026-02-17 12:47:39 +05:30
|
|
|
return <HeadingElement variant="h5" {...props} />;
|
2026-02-16 00:11:34 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function H6Element(props: PlateElementProps) {
|
2026-02-17 12:47:39 +05:30
|
|
|
return <HeadingElement variant="h6" {...props} />;
|
2026-02-16 00:11:34 +05:30
|
|
|
}
|