File refactoring and react errors.

This commit is contained in:
charlesgauthereau
2025-12-21 09:59:49 +01:00
parent e953de0e06
commit 82ab2c63d6
6 changed files with 114 additions and 121 deletions
@@ -1,36 +1,3 @@
// import Link from "next/link";
// import {cn} from "@/lib/utils";
// import {Plus} from "lucide-react";
//
// type EmptyStatePlaceholderProps = {
// url?: string;
// text: string;
// className?: string;
// }
//
// export const EmptyStatePlaceholder = ({url, text, className}: EmptyStatePlaceholderProps) => {
// return (
// <div className={cn("",className)}>{url ?
// <Link
// href={url}
// className={cn(
// "h-full",
// "flex flex-col items-center justify-center w-full rounded-2xl border border-dashed border-muted p-6 lg:p-10",
// "hover:bg-muted/50 transition-colors text-muted-foreground hover:text-primary text-center space-y-2"
// )}
// >
// <Plus className="w-5 h-5 lg:w-6 lg:h-6"/>
// <span className="text-sm lg:text-base font-medium">{text}</span>
// </Link>
// :
// <div className="flex h-full flex-col items-center justify-center py-12 text-center">
// <p className="text-lg text-muted-foreground">{text}</p>
// </div>
// }
// </div>
//
// )
// }
import Link from "next/link";
import {cn} from "@/lib/utils";
import {Plus} from "lucide-react";
@@ -48,25 +15,27 @@ export const EmptyStatePlaceholder = ({
text,
className,
}: EmptyStatePlaceholderProps) => {
const content = (
const Container = (
<div
className={cn(
"flex h-full flex-col items-center justify-center w-full rounded-2xl border border-dashed border-muted p-6 lg:p-10",
"hover:bg-muted/50 transition-colors text-muted-foreground hover:text-primary text-center space-y-4 cursor-pointer",
onClick || url ? "cursor-pointer" : "cursor-default"
"hover:bg-muted/50 transition-colors text-muted-foreground hover:text-primary text-center space-y-4",
(onClick || url) && "cursor-pointer"
)}
{...(onClick ? {onClick} : url ? {asChild: true} : {})}
onClick={onClick}
>
<Plus className="w-5 h-5 lg:w-6 lg:h-6"/>
<div>
<p className="text-sm ">{text}</p>
</div>
<Plus className="w-5 h-5 lg:w-6 lg:h-6" />
<p className="text-sm">{text}</p>
</div>
);
return (
<div className={cn("", className)}>
{url ? <Link href={url}>{content}</Link> : content}
</div>
);
};
if (url) {
return (
<div className={cn(className)}>
<Link href={url}>{Container}</Link>
</div>
);
}
return <div className={cn(className)}>{Container}</div>;
};