feat: add multiple layout components with suspense fallback for loading states

This commit is contained in:
rstubryan
2025-10-09 09:38:16 +07:00
parent 3051e931ca
commit 9f2add3a57
8 changed files with 164 additions and 0 deletions
@@ -0,0 +1,21 @@
'use client';
import { Suspense } from 'react';
export default function AreaLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<Suspense
fallback={
<div className='w-full flex flex-row justify-center items-center p-4'>
<span className='loading loading-spinner loading-xl' />
</div>
}
>
{children}
</Suspense>
);
}
@@ -0,0 +1,21 @@
'use client';
import { Suspense } from 'react';
export default function KandangLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<Suspense
fallback={
<div className='w-full flex flex-row justify-center items-center p-4'>
<span className='loading loading-spinner loading-xl' />
</div>
}
>
{children}
</Suspense>
);
}
@@ -0,0 +1,21 @@
'use client';
import { Suspense } from 'react';
export default function LocationLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<Suspense
fallback={
<div className='w-full flex flex-row justify-center items-center p-4'>
<span className='loading loading-spinner loading-xl' />
</div>
}
>
{children}
</Suspense>
);
}
@@ -0,0 +1,21 @@
'use client';
import { Suspense } from 'react';
export default function NonstockLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<Suspense
fallback={
<div className='w-full flex flex-row justify-center items-center p-4'>
<span className='loading loading-spinner loading-xl' />
</div>
}
>
{children}
</Suspense>
);
}
@@ -0,0 +1,21 @@
'use client';
import { Suspense } from 'react';
export default function ProductCategoryLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<Suspense
fallback={
<div className='w-full flex flex-row justify-center items-center p-4'>
<span className='loading loading-spinner loading-xl' />
</div>
}
>
{children}
</Suspense>
);
}
@@ -0,0 +1,21 @@
'use client';
import { Suspense } from 'react';
export default function ProductLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<Suspense
fallback={
<div className='w-full flex flex-row justify-center items-center p-4'>
<span className='loading loading-spinner loading-xl' />
</div>
}
>
{children}
</Suspense>
);
}
+17
View File
@@ -0,0 +1,17 @@
'use client';
import { Suspense } from 'react';
export default function UomLayout({ children }: { children: React.ReactNode }) {
return (
<Suspense
fallback={
<div className='w-full flex flex-row justify-center items-center p-4'>
<span className='loading loading-spinner loading-xl' />
</div>
}
>
{children}
</Suspense>
);
}
@@ -0,0 +1,21 @@
'use client';
import { Suspense } from 'react';
export default function WarehouseLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<Suspense
fallback={
<div className='w-full flex flex-row justify-center items-center p-4'>
<span className='loading loading-spinner loading-xl' />
</div>
}
>
{children}
</Suspense>
);
}