initial commit
This commit is contained in:
commit
30f2b4714d
43 changed files with 3654 additions and 0 deletions
29
components/Title.tsx
Normal file
29
components/Title.tsx
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* Copyright (c) 2025 xwra
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { ComponentChildren, h } from "preact";
|
||||
|
||||
interface TitleProps {
|
||||
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
||||
children: ComponentChildren;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export default function Title({
|
||||
level = 1,
|
||||
children,
|
||||
class: className,
|
||||
...props
|
||||
}: TitleProps) {
|
||||
const Heading = `h${Math.min(Math.max(level, 1), 6)}`;
|
||||
return h(
|
||||
Heading,
|
||||
{
|
||||
class: `title title-${level} ${className || ""}`,
|
||||
...props,
|
||||
},
|
||||
children,
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue