-
-
+
+
diff --git a/src/components/example/ButtonExample.tsx b/src/components/example/ButtonExample.tsx
index 4ed80e6..f4379da 100644
--- a/src/components/example/ButtonExample.tsx
+++ b/src/components/example/ButtonExample.tsx
@@ -1,10 +1,10 @@
-import Button from "@/components/neobruu/Button";
+import { Button } from "@/components/neobruu/Button";
export default function ButtonExample() {
return (
- Button
- Button
+ Button
+ Button
Button
)
diff --git a/src/components/example/CardExample.tsx b/src/components/example/CardExample.tsx
index 0b92e24..e6d1cef 100644
--- a/src/components/example/CardExample.tsx
+++ b/src/components/example/CardExample.tsx
@@ -1,5 +1,5 @@
import Card from "@/components/neobruu/Card";
-import Button from "@/components/neobruu/Button";
+import { Button } from "@/components/neobruu/Button";
export default function CardExample() {
return (
diff --git a/src/components/example/DialogExample.tsx b/src/components/example/DialogExample.tsx
index 678ab3b..7e77f20 100644
--- a/src/components/example/DialogExample.tsx
+++ b/src/components/example/DialogExample.tsx
@@ -2,7 +2,7 @@
import { useState } from "react";
import Dialog from "@/components/neobruu/Dialog";
-import Button from "@/components/neobruu/Button";
+import {Button} from "@/components/neobruu/Button";
export default function DialogExample() {
const [showDialog, setShowDialog] = useState(false);
@@ -26,7 +26,7 @@ export default function DialogExample() {
- Okay
+ Okay
diff --git a/src/components/example/DrawerExample.tsx b/src/components/example/DrawerExample.tsx
index 63f4d5d..0b902fd 100644
--- a/src/components/example/DrawerExample.tsx
+++ b/src/components/example/DrawerExample.tsx
@@ -1,7 +1,7 @@
'use client'
import Drawer from "@/components/neobruu/Drawer";
import { useState } from "react";
-import Button from "@/components/neobruu/Button";
+import { Button } from "@/components/neobruu/Button";
export default function DrawerExample() {
const [isDrawerOpen, setIsDrawerOpen] = useState(false);
diff --git a/src/components/example/ToastExample.tsx b/src/components/example/ToastExample.tsx
index f371b5f..f05e93c 100644
--- a/src/components/example/ToastExample.tsx
+++ b/src/components/example/ToastExample.tsx
@@ -3,7 +3,7 @@ import { useState } from "react";
import { HiExclamation } from "react-icons/hi"
import Toast from "@/components/neobruu/Toast";
-import Button from "@/components/neobruu/Button";
+import {Button} from "@/components/neobruu/Button";
export default function ToastExample() {
const [showToast, setShowToast] = useState(false);
diff --git a/src/components/example/TooltipExample.tsx b/src/components/example/TooltipExample.tsx
index a6043a6..fa181eb 100644
--- a/src/components/example/TooltipExample.tsx
+++ b/src/components/example/TooltipExample.tsx
@@ -1,5 +1,5 @@
import Tooltip from "@/components/neobruu/Tooltip";
-import Button from "@/components/neobruu/Button";
+import { Button } from "@/components/neobruu/Button";
export default function TooltipExample() {
@@ -7,7 +7,7 @@ export default function TooltipExample() {
- Hover
+ Hover
Hello World!
diff --git a/src/components/neobruu/Alert.tsx b/src/components/neobruu/Alert.tsx
index 3217179..8b3d5d5 100644
--- a/src/components/neobruu/Alert.tsx
+++ b/src/components/neobruu/Alert.tsx
@@ -1,57 +1,66 @@
'use client'
-import { useState } from 'react';
-import { IoClose } from 'react-icons/io5'
+import React, { useState } from 'react';
+import { IoClose } from 'react-icons/io5';
+import { VariantProps, cva } from 'class-variance-authority';
type Props = {
children: React.ReactNode;
icon: React.JSX.Element;
- variant: 'primary' | 'secondary' | 'light' | 'dark' | 'blue';
- rounded?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
};
-export default function Alert({
+const alertVariants = cva(
+ 'w-full flex justify-between cursor-pointer items-center gap-3 text-sm md:text-base shadow-[2px_2px_0px_0px] px-4 md:px-5 py-2 md:py-3 transition-all',
+ {
+ variants: {
+ variant: {
+ primary: 'border-orange-700 bg-orange-300/85 text-zinc-800',
+ secondary: 'border-pink-700 bg-pink-400/85 text-zinc-800',
+ light: 'border-slate-300 bg-slate-50/85 text-zinc-800',
+ dark: 'border-zinc-900 bg-zinc-800/85 text-white',
+ blue: 'border-blue-500 bg-blue-400 text-zinc-800',
+ },
+ rounded: {
+ none: 'rounded-none',
+ sm: 'rounded-sm',
+ md: 'rounded-md',
+ lg: 'rounded-lg',
+ xl: 'rounded-xl',
+ full: 'rounded-full',
+ },
+ },
+ defaultVariants: {
+ variant: 'primary',
+ rounded: 'none',
+ },
+ }
+);
+
+const Alert: React.FC
> = ({
children,
icon,
variant = 'primary',
- rounded = 'none'
-}: Props) {
-
+ rounded = 'none',
+ ...props
+}) => {
const [visible, setVisible] = useState(true);
const handleAlert = () => {
setVisible(!visible);
- }
+ };
- const getColors = () => {
- switch (variant) {
- case 'primary':
- return 'border-orange-700 bg-orange-300/85 text-zinc-800';
- case 'secondary':
- return 'border-pink-700 bg-pink-400/85 text-zinc-800';
- case 'light':
- return 'border-slate-300 bg-slate-50/85 text-zinc-800';
- case 'dark':
- return 'border-zinc-900 bg-zinc-800/85 text-white';
- case 'blue':
- return 'border-blue-500 bg-blue-400 text-zinc-800';
- default:
- return 'border-orange-500 bg-orange-400 text-zinc-800';
- }
- }
+ if (!visible) return null;
return (
- visible && (
-
-
- {icon}
-
+
+
+ {icon}
{children}
-
-
-
- )
+
+
+
+
);
-}
+};
+
+export default Alert;
diff --git a/src/components/neobruu/Badge.tsx b/src/components/neobruu/Badge.tsx
index c747a2a..5fb8b3c 100644
--- a/src/components/neobruu/Badge.tsx
+++ b/src/components/neobruu/Badge.tsx
@@ -1,42 +1,51 @@
-'use client'
+import React from 'react';
+import { VariantProps, cva } from 'class-variance-authority';
+
type Props = {
text: string;
- variant?: 'primary' | 'secondary' | 'light' | 'dark' | 'blue' | 'yellow' | 'green' | 'red' ;
- rounded?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
};
-export default function Badge({
- text,
- variant = 'primary',
- rounded = 'none'
-}: Props) {
- const getColors = () => {
- switch (variant) {
- case 'primary':
- return 'border-orange-700 bg-orange-400/70';
- case 'secondary':
- return 'border-pink-700 bg-pink-500/70';
- case 'light':
- return 'text-zinc-900 border-slate-300 bg-slate-50/70';
- case 'dark':
- return 'border-zinc-900 bg-zinc-700/70 text-white';
- case 'blue':
- return 'border-blue-700 bg-blue-500/70';
- case 'yellow':
- return 'border-[#d3aa2f] bg-[#f7cb46]/70';
- case 'green':
- return 'border-green-700 bg-green-500/70';
- case 'red':
- return 'border-red-700 bg-red-500/70';
- default:
- return 'border-orange-700 bg-orange-500/70';
- }
+const badgeVariants = cva(
+ 'flex cursor-default items-center text-xs font-medium hover:shadow-[1px_1px_0px_0px_rgba(0,0,0,1)] transition-all',
+ {
+ variants: {
+ variant: {
+ default: 'border-orange-700 bg-orange-400/70',
+ pink: 'border-pink-700 bg-pink-500/70',
+ light: 'text-zinc-900 border-slate-300 bg-slate-50/70',
+ dark: 'border-zinc-900 bg-zinc-700/70 text-white',
+ blue: 'border-blue-700 bg-blue-500/70',
+ yellow: 'border-[#d3aa2f] bg-[#f7cb46]/70',
+ green: 'border-green-700 bg-green-500/70',
+ red: 'border-red-700 bg-red-500/70',
+ },
+ rounded: {
+ none: 'rounded-none',
+ sm: 'rounded-sm',
+ md: 'rounded-md',
+ lg: 'rounded-lg',
+ xl: 'rounded-xl',
+ full: 'rounded-full',
+ },
+ },
+ defaultVariants: {
+ variant: 'default',
+ rounded: 'none',
+ },
}
+);
+
+const Badge: React.FC
> = ({
+ text,
+ variant = 'default',
+ rounded = 'none',
+ ...props
+}) => {
return (
-
+
{text}
);
-}
+};
+
+export default Badge;
diff --git a/src/components/neobruu/Button.tsx b/src/components/neobruu/Button.tsx
index 308d40d..952814e 100644
--- a/src/components/neobruu/Button.tsx
+++ b/src/components/neobruu/Button.tsx
@@ -1,47 +1,79 @@
'use client'
-type Props = {
- children: React.ReactNode;
- onClick?: (event: React.MouseEvent) => void;
- variant?: 'primary' | 'secondary' | 'light' | 'dark' | 'blue' | 'yellow' | 'green' | 'red' ;
- rounded?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
-};
+import * as React from 'react'
+import Link from 'next/link'
+import { VariantProps, cva } from 'class-variance-authority'
-export default function Button({
- children,
- onClick,
- variant = 'primary',
- rounded = 'none'
-}: Props) {
- const getColors = () => {
- switch (variant) {
- case 'primary':
- return 'border-black bg-orange-400';
- case 'secondary':
- return 'border-black bg-pink-500';
- case 'light':
- return 'border-black bg-slate-50';
- case 'dark':
- return 'border-white/10 bg-zinc-900 text-white';
- case 'blue':
- return 'border-black bg-blue-500';
- case 'yellow':
- return 'border-black bg-[#f7cb46]';
- case 'green':
- return 'border-black bg-green-500';
- case 'red':
- return 'border-black bg-red-500';
- default:
- return 'border-black bg-orange-500';
- }
+import { cn } from '@/lib/utils'
+
+const buttonVariants = cva(
+ 'inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors border-2 border-black shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] transition-all active:translate-x-[3px] active:translate-y-[3px] active:shadow-none',
+ {
+ variants: {
+ variant: {
+ default:
+ 'bg-orange-400',
+ red:
+ 'bg-red-500',
+ blue:
+ 'bg-blue-500',
+ green:
+ 'bg-green-500',
+ yellow:
+ 'bg-[#f7cb46]',
+ pink: 'bg-pink-500',
+ dark: 'bg-zinc-900'
+ },
+ size: {
+ default: 'h-10 py-2 px-4',
+ sm: 'h-9 px-2 rounded-md',
+ lg: 'h-11 px-8 rounded-md',
+ },
+ rounded: {
+ none: 'rounded-none',
+ sm: 'rounded-sm',
+ md: 'rounded-md',
+ lg: 'rounded-lg',
+ xl: 'rounded-xl',
+ full: 'rounded-full'
+ }
+ },
+ defaultVariants: {
+ variant: 'default',
+ size: 'default',
+ rounded: 'none'
+ },
+ }
+)
+
+export interface ButtonProps
+ extends React.ButtonHTMLAttributes,
+ VariantProps {
+ href?: string
+}
+
+const Button = React.forwardRef(
+ ({ className, children, href, variant, size, ...props }, ref) => {
+ if (href) {
+ return (
+
+ {children}
+
+ )
}
return (
-
- {children}
-
- );
-}
+
+ {children}
+
+ )
+ }
+)
+Button.displayName = 'Button'
+
+export { Button, buttonVariants }
\ No newline at end of file
diff --git a/src/data/components.ts b/src/data/components.ts
index 7763fbc..394e37d 100644
--- a/src/data/components.ts
+++ b/src/data/components.ts
@@ -1,7 +1,7 @@
import Accordion from '@/components/neobruu/Accordion'
import Alert from '@/components/neobruu/Alert'
import Avatar from '@/components/neobruu/Avatar'
-import Button from '@/components/neobruu/Button'
+import {Button} from '@/components/neobruu/Button'
import Badge from '@/components/neobruu/Badge'
import Card from '@/components/neobruu/Card'
import Checkbox from '@/components/neobruu/Checkbox'
diff --git a/src/lib/utils.ts b/src/lib/utils.ts
new file mode 100644
index 0000000..4297d12
--- /dev/null
+++ b/src/lib/utils.ts
@@ -0,0 +1,6 @@
+import { ClassValue, clsx } from 'clsx'
+import { twMerge } from 'tailwind-merge'
+
+export function cn(...inputs: ClassValue[]) {
+ return twMerge(clsx(inputs))
+}
\ No newline at end of file