First Commit
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
import {
|
||||
AnchorHTMLAttributes,
|
||||
ButtonHTMLAttributes,
|
||||
DetailedHTMLProps,
|
||||
HTMLAttributeAnchorTarget,
|
||||
HTMLAttributes,
|
||||
} from "react";
|
||||
import { ClassNameValue, twMerge } from "tailwind-merge";
|
||||
|
||||
export default function Button({
|
||||
href,
|
||||
target,
|
||||
variant,
|
||||
color,
|
||||
linkProps,
|
||||
...props
|
||||
}: DetailedHTMLProps<
|
||||
ButtonHTMLAttributes<HTMLButtonElement>,
|
||||
HTMLButtonElement
|
||||
> & {
|
||||
variant?: "normal" | "ghost" | "outlined";
|
||||
color?: "primary" | "secondary" | "accent";
|
||||
href?: string;
|
||||
target?: HTMLAttributeAnchorTarget;
|
||||
linkProps?: DetailedHTMLProps<
|
||||
AnchorHTMLAttributes<HTMLAnchorElement>,
|
||||
HTMLAnchorElement
|
||||
>;
|
||||
}) {
|
||||
const finalClassName: string = (() => {
|
||||
if (variant == "normal" || !variant) {
|
||||
if (color == "primary" || !color) return "bg-blue-500 text-white";
|
||||
} else if (variant == "outlined") {
|
||||
if (color == "primary" || !color)
|
||||
return (
|
||||
"bg-transparent outline outline-1 outline-blue-500" +
|
||||
" text-blue-500"
|
||||
);
|
||||
} else if (variant == "ghost") {
|
||||
}
|
||||
|
||||
return "";
|
||||
})();
|
||||
|
||||
const buttonComponent = (
|
||||
<button
|
||||
{...props}
|
||||
className={twMerge(
|
||||
"bg-blue-600 text-white text-base font-medium px-4 py-2 rounded",
|
||||
finalClassName,
|
||||
props.className
|
||||
)}
|
||||
>
|
||||
{props.children}
|
||||
</button>
|
||||
);
|
||||
|
||||
if (href)
|
||||
return (
|
||||
<a {...linkProps} href={href} target={target}>
|
||||
{buttonComponent}
|
||||
</a>
|
||||
);
|
||||
return buttonComponent;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import { DetailedHTMLProps, HTMLAttributes } from "react";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
/**
|
||||
* # Default Container
|
||||
* @className twui-container
|
||||
*/
|
||||
export default function Container({
|
||||
...props
|
||||
}: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>) {
|
||||
return (
|
||||
<div
|
||||
{...props}
|
||||
className={twMerge(
|
||||
"flex flex-row items-center w-full max-w-[1200px]",
|
||||
"twui-container",
|
||||
props.className
|
||||
)}
|
||||
>
|
||||
{props.children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { DetailedHTMLProps, HTMLAttributes } from "react";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export default function Footer({
|
||||
...props
|
||||
}: DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>) {
|
||||
return (
|
||||
<header
|
||||
{...props}
|
||||
className={twMerge(
|
||||
"flex flex-col items-center justify-center",
|
||||
"px-4 sm:px-10 py-2",
|
||||
"border-0 border-b border-slate-200 border-solid",
|
||||
"twui-footer",
|
||||
props.className
|
||||
)}
|
||||
>
|
||||
{props.children}
|
||||
</header>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { DetailedHTMLProps, HTMLAttributes } from "react";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export default function H1({
|
||||
...props
|
||||
}: DetailedHTMLProps<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>) {
|
||||
return (
|
||||
<h1 {...props} className={twMerge("text-5xl mb-4", props.className)}>
|
||||
{props.children}
|
||||
</h1>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { DetailedHTMLProps, HTMLAttributes } from "react";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export default function H2({
|
||||
...props
|
||||
}: DetailedHTMLProps<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>) {
|
||||
return (
|
||||
<h2 {...props} className={twMerge("text-3xl mb-4", props.className)}>
|
||||
{props.children}
|
||||
</h2>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { DetailedHTMLProps, HTMLAttributes } from "react";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export default function H3({
|
||||
...props
|
||||
}: DetailedHTMLProps<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>) {
|
||||
return (
|
||||
<h3 {...props} className={twMerge("text-xl mb-4", props.className)}>
|
||||
{props.children}
|
||||
</h3>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { DetailedHTMLProps, HTMLAttributes } from "react";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export default function H4({
|
||||
...props
|
||||
}: DetailedHTMLProps<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>) {
|
||||
return (
|
||||
<h4 {...props} className={twMerge("text-base mb-4", props.className)}>
|
||||
{props.children}
|
||||
</h4>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { DetailedHTMLProps, HTMLAttributes } from "react";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export default function H5({
|
||||
...props
|
||||
}: DetailedHTMLProps<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>) {
|
||||
return (
|
||||
<h5 {...props} className={twMerge("text-sm mb-4", props.className)}>
|
||||
{props.children}
|
||||
</h5>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { DetailedHTMLProps, HTMLAttributes } from "react";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export default function HR({
|
||||
...props
|
||||
}: DetailedHTMLProps<HTMLAttributes<HTMLHRElement>, HTMLHRElement>) {
|
||||
return (
|
||||
<hr
|
||||
{...props}
|
||||
className={twMerge(
|
||||
"bg-slate-400 w-full dark:bg-white/20 my-4",
|
||||
props.className
|
||||
)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { DetailedHTMLProps, HTMLAttributes } from "react";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
/**
|
||||
* # Default Header
|
||||
* @className twui-header
|
||||
*/
|
||||
export default function Header({
|
||||
...props
|
||||
}: DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>) {
|
||||
return (
|
||||
<header
|
||||
{...props}
|
||||
className={twMerge(
|
||||
"flex flex-col items-center justify-center",
|
||||
"px-4 sm:px-10 py-2",
|
||||
"border-0 border-b border-slate-200 border-solid",
|
||||
"twui-header",
|
||||
props.className
|
||||
)}
|
||||
>
|
||||
{props.children}
|
||||
</header>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { AnchorHTMLAttributes, DetailedHTMLProps } from "react";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export default function Link({
|
||||
...props
|
||||
}: DetailedHTMLProps<
|
||||
AnchorHTMLAttributes<HTMLAnchorElement>,
|
||||
HTMLAnchorElement
|
||||
>) {
|
||||
return (
|
||||
<a
|
||||
{...props}
|
||||
className={twMerge(
|
||||
"text-base text-link-500 no-underline hover:text-link-500/50",
|
||||
props.className
|
||||
)}
|
||||
>
|
||||
{props.children}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { DetailedHTMLProps, HTMLAttributes } from "react";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export default function Main({
|
||||
...props
|
||||
}: DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>) {
|
||||
return (
|
||||
<main
|
||||
{...props}
|
||||
className={twMerge(
|
||||
"flex flex-col items-start w-full",
|
||||
props.className
|
||||
)}
|
||||
>
|
||||
{props.children}
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { DetailedHTMLProps, HTMLAttributes } from "react";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export default function P({
|
||||
...props
|
||||
}: DetailedHTMLProps<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>) {
|
||||
return (
|
||||
<p {...props} className={twMerge("text-base py-4", props.className)}>
|
||||
{props.children}
|
||||
</p>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { DetailedHTMLProps, HTMLAttributes } from "react";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export default function Row({
|
||||
...props
|
||||
}: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>) {
|
||||
return (
|
||||
<div
|
||||
{...props}
|
||||
className={twMerge(
|
||||
"flex flex-row items-center gap-2",
|
||||
props.className
|
||||
)}
|
||||
>
|
||||
{props.children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { DetailedHTMLProps, HTMLAttributes } from "react";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export default function Section({
|
||||
...props
|
||||
}: DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>) {
|
||||
return (
|
||||
<section
|
||||
{...props}
|
||||
className={twMerge(
|
||||
"flex flex-col items-center w-full",
|
||||
"px-4 sm:px-10 py-10",
|
||||
props.className
|
||||
)}
|
||||
>
|
||||
{props.children}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { DetailedHTMLProps, HTMLAttributes } from "react";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export default function Span({
|
||||
...props
|
||||
}: DetailedHTMLProps<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>) {
|
||||
return (
|
||||
<span {...props} className={twMerge("text-base", props.className)}>
|
||||
{props.children}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { DetailedHTMLProps, HTMLAttributes } from "react";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export default function Stack({
|
||||
...props
|
||||
}: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>) {
|
||||
return (
|
||||
<div
|
||||
{...props}
|
||||
className={twMerge("flex flex-col items-start", props.className)}
|
||||
>
|
||||
{props.children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user