initial commit
This commit is contained in:
commit
30f2b4714d
43 changed files with 3654 additions and 0 deletions
22
components/Box.tsx
Normal file
22
components/Box.tsx
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* Copyright (c) 2025 xwra
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { ComponentChildren, h } from "preact";
|
||||
import { LinkIcon } from "./Icon.tsx";
|
||||
|
||||
interface PolygonBoxProps {
|
||||
as?: keyof HTMLElementTagNameMap;
|
||||
children?: ComponentChildren;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export default function Box(
|
||||
{ as: Tag = "span", class: className, children, ...props }: PolygonBoxProps,
|
||||
) {
|
||||
const content = Tag === "a"
|
||||
? [children, h(LinkIcon, { size: 16, class: "link-icon" })]
|
||||
: children;
|
||||
return h(Tag, { class: `box ${className || ""}`, ...props }, content);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue