summaryrefslogtreecommitdiffstats
path: root/src/ui/layouts/Container.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/layouts/Container.tsx')
-rw-r--r--src/ui/layouts/Container.tsx33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/ui/layouts/Container.tsx b/src/ui/layouts/Container.tsx
new file mode 100644
index 0000000..7ce7ed5
--- /dev/null
+++ b/src/ui/layouts/Container.tsx
@@ -0,0 +1,33 @@
1import type { HTMLTag, Polymorphic } from "corvos/plugins/jsx.ts";
2
3export type Props<Tag extends HTMLTag> = Polymorphic<{
4 "as": Tag;
5 "pad-inline"?: boolean;
6 "pad-block"?: boolean;
7 "size"?: "sm";
8 "fixed"?: boolean | "150" | "200";
9}>;
10
11export const Container = <T extends HTMLTag = "div">({
12 as: Tag = "div" as T,
13 class: cls,
14 "pad-inline": padInline,
15 "pad-block": padBlock,
16 fixed,
17 size,
18 ...props
19}: Props<T>) => (
20 <Tag
21 class:list={[
22 "l-container",
23 {
24 "l-container--pad-i": padInline,
25 "l-container--pad-b": padBlock,
26 [`l-container--${size}`]: size,
27 [`l-container--fixed${typeof fixed === "boolean" ? "" : `-${fixed}`}`]: fixed,
28 },
29 cls,
30 ]}
31 {...props}
32 />
33);