579 lines
20 KiB
JavaScript
579 lines
20 KiB
JavaScript
import { useEffect, useMemo, useRef, useState } from "react";
|
||
import {
|
||
Box,
|
||
Button,
|
||
ChakraProvider,
|
||
Code,
|
||
Container,
|
||
Flex,
|
||
Heading,
|
||
HStack,
|
||
SimpleGrid,
|
||
Stack,
|
||
Text,
|
||
} from "@chakra-ui/react";
|
||
import { AppHeader, AppSidebar, Pagination } from "../remote/ui/index.jsx";
|
||
import demoLogo from "./demo-logo.svg";
|
||
import demoExtraLogo from "./demo-extra-logo.svg";
|
||
import biLogo from "../remote/ui/AppHeader/bi-logo.webp";
|
||
|
||
const HEADER_USAGE = `import { AppHeader } from "uikit/remote/ui";
|
||
|
||
export default function PageHeader() {
|
||
return (
|
||
<AppHeader bg="#314E89">
|
||
<AppHeader.BrandSection>
|
||
<AppHeader.Logo src="/logo.png" alt="نشان سامانه" />
|
||
|
||
<AppHeader.Brand>
|
||
<AppHeader.Title>عنوان سامانه</AppHeader.Title>
|
||
<AppHeader.Description>
|
||
توضیحات سامانه
|
||
</AppHeader.Description>
|
||
</AppHeader.Brand>
|
||
</AppHeader.BrandSection>
|
||
|
||
{/* اختیاری: لوگو و متن دلخواه در انتهای هدر */}
|
||
<AppHeader.Extra
|
||
src="/secondary-logo.png"
|
||
alt="نشان تکمیلی"
|
||
text="متن دلخواه"
|
||
/>
|
||
|
||
{/* اختیاری */}
|
||
<AppHeader.Bi />
|
||
</AppHeader>
|
||
);
|
||
}`;
|
||
|
||
const SIDEBAR_USAGE = `import { AppSidebar } from "uikit/remote/ui";
|
||
|
||
const items = [
|
||
{
|
||
id: "analysis",
|
||
title: "آنالیز",
|
||
mobileTitle: "آنالیز",
|
||
icon: AnalyzeIcon,
|
||
active: pathname === "/analysis",
|
||
disabled: false,
|
||
onClick: () => router.push("/analysis"),
|
||
},
|
||
{
|
||
id: "users",
|
||
title: "کاربران",
|
||
mobileTitle: "کاربران",
|
||
icon: UsersIcon,
|
||
active: pathname === "/users",
|
||
onClick: () => router.push("/users"),
|
||
},
|
||
];
|
||
|
||
export default function PageSidebar() {
|
||
return (
|
||
<AppSidebar items={items}>
|
||
<AppSidebar.Exit onClick={() => logout()} />
|
||
</AppSidebar>
|
||
);
|
||
}`;
|
||
|
||
const PAGINATION_USAGE = `import { Pagination } from "uikit/remote/ui";
|
||
|
||
<Pagination
|
||
level="minimal"
|
||
currentPage={page}
|
||
totalPages={totalPages}
|
||
totalCount={totalCount}
|
||
pageSize={10}
|
||
loading={isLoading}
|
||
onPageChange={(nextPage) => setPage(nextPage)}
|
||
/>
|
||
|
||
// loading اختیاری است.
|
||
// اگر نیاز نداری، اصلاً آن را پاس نده.`;
|
||
|
||
function CodeBlock({ children }) {
|
||
const [copied, setCopied] = useState(false);
|
||
const code = typeof children === "string" ? children : String(children ?? "");
|
||
|
||
const copyCode = async () => {
|
||
try {
|
||
if (navigator.clipboard?.writeText) {
|
||
await navigator.clipboard.writeText(code);
|
||
} else {
|
||
const textarea = document.createElement("textarea");
|
||
textarea.value = code;
|
||
textarea.style.position = "fixed";
|
||
textarea.style.opacity = "0";
|
||
document.body.appendChild(textarea);
|
||
textarea.select();
|
||
document.execCommand("copy");
|
||
textarea.remove();
|
||
}
|
||
|
||
setCopied(true);
|
||
window.setTimeout(() => setCopied(false), 1400);
|
||
} catch (error) {
|
||
console.error("Copy failed:", error);
|
||
}
|
||
};
|
||
|
||
return (
|
||
<Box position="relative" w="full">
|
||
<Button
|
||
type="button"
|
||
size="xs"
|
||
position="absolute"
|
||
top={2}
|
||
right={2}
|
||
zIndex={1}
|
||
bg="whiteAlpha.200"
|
||
color="white"
|
||
_hover={{ bg: "whiteAlpha.300" }}
|
||
onClick={copyCode}
|
||
>
|
||
{copied ? "کپی شد" : "کپی کد"}
|
||
</Button>
|
||
|
||
<Box
|
||
as="pre"
|
||
dir="ltr"
|
||
textAlign="left"
|
||
overflowX="auto"
|
||
w="full"
|
||
p={{ base: 3, md: 4 }}
|
||
pt={{ base: 10, md: 10 }}
|
||
bg="gray.900"
|
||
color="gray.100"
|
||
borderRadius="lg"
|
||
fontSize={{ base: "12px", md: "13px" }}
|
||
lineHeight="1.8"
|
||
whiteSpace="pre"
|
||
>
|
||
<Box as="code">{code}</Box>
|
||
</Box>
|
||
</Box>
|
||
);
|
||
}
|
||
|
||
function DocsSection({ id, title, children }) {
|
||
return (
|
||
<Box
|
||
id={id}
|
||
scrollMarginTop="18px"
|
||
bg="white"
|
||
borderWidth="1px"
|
||
borderColor="gray.200"
|
||
borderRadius="xl"
|
||
overflow="hidden"
|
||
>
|
||
<Box px={{ base: 4, md: 5 }} py={4} borderBottomWidth="1px" borderColor="gray.100">
|
||
<Text fontSize={{ base: "md", md: "lg" }} fontWeight="700" color="gray.800">
|
||
{title}
|
||
</Text>
|
||
</Box>
|
||
<Box p={{ base: 4, md: 5 }}>{children}</Box>
|
||
</Box>
|
||
);
|
||
}
|
||
|
||
const IconChart = () => (
|
||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" aria-hidden="true">
|
||
<path d="M4 19V9" />
|
||
<path d="M10 19V5" />
|
||
<path d="M16 19v-7" />
|
||
<path d="M22 19H2" />
|
||
</svg>
|
||
);
|
||
|
||
const IconUsers = () => (
|
||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" aria-hidden="true">
|
||
<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" />
|
||
<circle cx="9" cy="7" r="4" />
|
||
<path d="M22 21v-2a4 4 0 0 0-3-3.87" />
|
||
<path d="M16 3.13a4 4 0 0 1 0 7.75" />
|
||
</svg>
|
||
);
|
||
|
||
const IconSearch = () => (
|
||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" aria-hidden="true">
|
||
<circle cx="11" cy="11" r="8" />
|
||
<path d="m21 21-4.35-4.35" />
|
||
</svg>
|
||
);
|
||
|
||
const IconLock = () => (
|
||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" aria-hidden="true">
|
||
<rect x="3" y="11" width="18" height="10" rx="2" />
|
||
<path d="M7 11V7a5 5 0 0 1 10 0v4" />
|
||
</svg>
|
||
);
|
||
|
||
function HeaderDocs() {
|
||
return (
|
||
<Stack spacing={5}>
|
||
<Text color="gray.600" fontSize="sm">
|
||
ظاهر Header داخل remote ایزوله است؛ فونت از سامانه مقصد میآید. رنگ پسزمینه با
|
||
<Code mx={1}>bg</Code>
|
||
اختیاری قابل تغییر است. <Code>AppHeader.Extra</Code> و <Code>AppHeader.Bi</Code> نیز مستقل و اختیاریاند.
|
||
</Text>
|
||
|
||
<CodeBlock>{HEADER_USAGE}</CodeBlock>
|
||
|
||
<Box>
|
||
<Text mb={2} fontWeight="700" fontSize="sm">نمونه نمایش</Text>
|
||
<Box overflow="auto" borderWidth="1px" borderColor="gray.200" borderRadius="lg">
|
||
<AppHeader bg="#314E89">
|
||
<AppHeader.BrandSection>
|
||
<AppHeader.Logo src={demoLogo} alt="نشان نمونه سامانه" />
|
||
<AppHeader.Brand>
|
||
<AppHeader.Title>عنوان سامانه</AppHeader.Title>
|
||
<AppHeader.Description>توضیحات سامانه</AppHeader.Description>
|
||
</AppHeader.Brand>
|
||
</AppHeader.BrandSection>
|
||
<AppHeader.Extra
|
||
src={demoExtraLogo}
|
||
alt="نشان تکمیلی"
|
||
text="متن تکمیلی"
|
||
/>
|
||
<AppHeader.Bi src={biLogo} />
|
||
</AppHeader>
|
||
</Box>
|
||
</Box>
|
||
|
||
<Box fontSize="sm" color="gray.600">
|
||
<Text>• ترتیب انتهای Header: <Code>Extra</Code> سپس <Code>Bi</Code>.</Text>
|
||
<Text mt={1}>• هرکدام از <Code>Extra</Code> یا <Code>Bi</Code> را میتوان حذف کرد.</Text>
|
||
<Text mt={1}>• <Code>Extra</Code> لوگو و متن دلخواه میگیرد؛ اگر <Code>text</Code> ندهی، فقط لوگو نمایش داده میشود و تمام ارتفاع Extra را میگیرد.</Text>
|
||
<Text mt={1}>• <Code>font-family</Code> عمداً از Host به ارث میرسد.</Text>
|
||
</Box>
|
||
</Stack>
|
||
);
|
||
}
|
||
|
||
function SidebarDocs({ allowFixedPreview = true }) {
|
||
const [activeId, setActiveId] = useState("analysis");
|
||
const [lastAction, setLastAction] = useState("—");
|
||
|
||
const items = useMemo(
|
||
() => [
|
||
{
|
||
id: "analysis",
|
||
title: "آنالیز",
|
||
mobileTitle: "آنالیز",
|
||
icon: IconChart,
|
||
active: activeId === "analysis",
|
||
onClick: () => {
|
||
setActiveId("analysis");
|
||
setLastAction("آنالیز");
|
||
},
|
||
},
|
||
{
|
||
id: "users",
|
||
title: "کاربران",
|
||
mobileTitle: "کاربران",
|
||
icon: IconUsers,
|
||
active: activeId === "users",
|
||
onClick: () => {
|
||
setActiveId("users");
|
||
setLastAction("کاربران");
|
||
},
|
||
},
|
||
{
|
||
id: "search",
|
||
title: "جستجو",
|
||
mobileTitle: "جستجو",
|
||
icon: IconSearch,
|
||
active: activeId === "search",
|
||
onClick: () => {
|
||
setActiveId("search");
|
||
setLastAction("جستجو");
|
||
},
|
||
},
|
||
{
|
||
id: "restricted",
|
||
title: "بخش محدود",
|
||
mobileTitle: "محدود",
|
||
icon: IconLock,
|
||
disabled: true,
|
||
},
|
||
],
|
||
[activeId],
|
||
);
|
||
|
||
return (
|
||
<Stack spacing={5}>
|
||
<Text color="gray.600" fontSize="sm">
|
||
UI داخل remote میماند؛ route، permission، active state و logout در خود سامانه مقصد تعیین میشوند.
|
||
</Text>
|
||
|
||
<CodeBlock>{SIDEBAR_USAGE}</CodeBlock>
|
||
|
||
<Box fontSize="sm" color="gray.600">
|
||
<Text>• برای مخفیکردن آیتم از <Code>hidden: true</Code> یا filter در Host استفاده کن.</Text>
|
||
<Text mt={1}>• برای حالت غیرقابل کلیک از <Code>disabled: true</Code> استفاده کن.</Text>
|
||
<Text mt={1}>• تا ۴ آیتم در موبایل، خروج مستقیم آخر Bottom Navigation قرار میگیرد.</Text>
|
||
<Text mt={1}>• بیشتر از ۴ آیتم: چهار آیتم اول مستقیم، بقیه + خروج داخل «بیشتر» میروند.</Text>
|
||
</Box>
|
||
|
||
<Box p={3} bg="gray.50" borderRadius="md" fontSize="sm">
|
||
آخرین callback: <Code>{lastAction}</Code>
|
||
</Box>
|
||
|
||
<Box display={{ base: "block", lg: "none" }} color="gray.500" fontSize="xs">
|
||
در موبایل نمونه AppSidebar به شکل Bottom Navigation پایین صفحه نمایش داده میشود.
|
||
</Box>
|
||
|
||
{allowFixedPreview ? (
|
||
<Box display={{ base: "block", lg: "none" }}>
|
||
<AppSidebar items={items} ariaLabel="نمونه AppSidebar">
|
||
<AppSidebar.Exit onClick={() => setLastAction("خروج")} />
|
||
</AppSidebar>
|
||
</Box>
|
||
) : null}
|
||
|
||
<Box display={{ base: "none", lg: "block" }} position="relative" h="360px" overflow="hidden" borderWidth="1px" borderColor="gray.200" borderRadius="lg">
|
||
<AppSidebar items={items} ariaLabel="نمونه AppSidebar">
|
||
<AppSidebar.Exit onClick={() => setLastAction("خروج")} />
|
||
</AppSidebar>
|
||
</Box>
|
||
</Stack>
|
||
);
|
||
}
|
||
|
||
function PaginationDocs() {
|
||
const [pages, setPages] = useState({ full: 3, compact: 3, simple: 3, minimal: 3 });
|
||
const [initialLoading, setInitialLoading] = useState(true);
|
||
const [transitionPage, setTransitionPage] = useState(3);
|
||
const [transitionLoading, setTransitionLoading] = useState(false);
|
||
const initialTimerRef = useRef(null);
|
||
const transitionTimerRef = useRef(null);
|
||
|
||
useEffect(() => {
|
||
initialTimerRef.current = window.setTimeout(() => setInitialLoading(false), 1800);
|
||
return () => {
|
||
if (initialTimerRef.current) window.clearTimeout(initialTimerRef.current);
|
||
if (transitionTimerRef.current) window.clearTimeout(transitionTimerRef.current);
|
||
};
|
||
}, []);
|
||
|
||
const setPage = (level, page) => setPages((previous) => ({ ...previous, [level]: page }));
|
||
|
||
const replayInitialLoading = () => {
|
||
if (initialTimerRef.current) window.clearTimeout(initialTimerRef.current);
|
||
setInitialLoading(true);
|
||
initialTimerRef.current = window.setTimeout(() => setInitialLoading(false), 1800);
|
||
};
|
||
|
||
const simulatePageRequest = (nextPage) => {
|
||
if (transitionLoading) return;
|
||
if (transitionTimerRef.current) window.clearTimeout(transitionTimerRef.current);
|
||
setTransitionPage(nextPage);
|
||
setTransitionLoading(true);
|
||
transitionTimerRef.current = window.setTimeout(() => setTransitionLoading(false), 1600);
|
||
};
|
||
|
||
const renderPagination = (level, props = {}) => (
|
||
<Box w="full" minW={0}>
|
||
<Text mb={2} fontSize="sm" fontWeight="600" dir="ltr">{level}</Text>
|
||
<Pagination
|
||
level={level}
|
||
currentPage={pages[level]}
|
||
totalPages={12}
|
||
totalCount={120}
|
||
pageSize={10}
|
||
onPageChange={(page) => setPage(level, page)}
|
||
{...props}
|
||
/>
|
||
</Box>
|
||
);
|
||
|
||
const renderGrid = (renderer) => (
|
||
<Stack spacing={4}>
|
||
{renderer("full")}
|
||
<Flex w="full" align="flex-start" direction={{ base: "column", lg: "row" }} gap={{ base: 4, lg: 0 }}>
|
||
<Box w={{ base: "100%", lg: "55%" }} minW={0}>{renderer("compact")}</Box>
|
||
<Box w={{ base: "100%", lg: "25%" }} minW={0}>{renderer("simple")}</Box>
|
||
<Box w={{ base: "100%", lg: "20%" }} minW={0}>{renderer("minimal")}</Box>
|
||
</Flex>
|
||
</Stack>
|
||
);
|
||
|
||
return (
|
||
<Stack spacing={6}>
|
||
<Text color="gray.600" fontSize="sm">
|
||
همه variantها API یکسان دارند. <Code>loading</Code> اختیاری است و اگر پاس داده نشود رفتار قبلی کاملاً حفظ میشود.
|
||
</Text>
|
||
|
||
<CodeBlock>{PAGINATION_USAGE}</CodeBlock>
|
||
|
||
<Box fontSize="sm" color="gray.600">
|
||
<Text>• <Code>currentPage</Code>: صفحه فعلی</Text>
|
||
<Text mt={1}>• <Code>totalPages</Code>: تعداد کل صفحات</Text>
|
||
<Text mt={1}>• <Code>totalCount</Code>: تعداد کل رکوردها</Text>
|
||
<Text mt={1}>• <Code>pageSize</Code>: تعداد رکورد در هر صفحه</Text>
|
||
<Text mt={1}>• <Code>onPageChange</Code>: callback تغییر صفحه</Text>
|
||
<Text mt={1}>• <Code>loading</Code>: اختیاری؛ پیشفرض <Code>false</Code></Text>
|
||
<Text mt={1}>• levelها: <Code>full</Code>، <Code>compact</Code>، <Code>simple</Code>، <Code>minimal</Code></Text>
|
||
</Box>
|
||
|
||
<Box>
|
||
<Text mb={3} fontWeight="700" fontSize="sm">نمونه حالتها</Text>
|
||
{renderGrid((level) => renderPagination(level))}
|
||
</Box>
|
||
|
||
<Box borderWidth="1px" borderColor="gray.200" borderRadius="xl" p={{ base: 3, md: 4 }} bg="gray.50">
|
||
<Flex mb={3} gap={3} align={{ base: "stretch", md: "center" }} justify="space-between" direction={{ base: "column", md: "row" }}>
|
||
<Box>
|
||
<Text fontWeight="700" fontSize="sm">Loading — دریافت اولیه</Text>
|
||
<Text mt={1} color="gray.600" fontSize="xs">
|
||
totalPages و totalCount هنوز وجود ندارند؛ صفحه ۱ ثابت میماند و جای مقادیر نامشخص loader دیده میشود.
|
||
</Text>
|
||
</Box>
|
||
<Button size="sm" variant="outline" onClick={replayInitialLoading} isDisabled={initialLoading} flexShrink={0}>
|
||
{initialLoading ? "در حال دریافت..." : "اجرای دوباره"}
|
||
</Button>
|
||
</Flex>
|
||
|
||
{renderGrid((level) => (
|
||
<Box w="full" minW={0}>
|
||
<Text mb={2} fontSize="sm" fontWeight="600" dir="ltr">{level}</Text>
|
||
<Pagination
|
||
level={level}
|
||
currentPage={1}
|
||
totalPages={initialLoading ? undefined : 12}
|
||
totalCount={initialLoading ? undefined : 120}
|
||
pageSize={10}
|
||
loading={initialLoading}
|
||
onPageChange={() => {}}
|
||
/>
|
||
</Box>
|
||
))}
|
||
</Box>
|
||
|
||
<Box borderWidth="1px" borderColor="gray.200" borderRadius="xl" p={{ base: 3, md: 4 }} bg="gray.50">
|
||
<Flex mb={3} gap={3} align={{ base: "stretch", md: "center" }} justify="space-between" direction={{ base: "column", md: "row" }}>
|
||
<Box>
|
||
<Text fontWeight="700" fontSize="sm">Loading — جابهجایی بین صفحات</Text>
|
||
<Text mt={1} color="gray.600" fontSize="xs">
|
||
totalPages و totalCount قبلی حفظ میشوند و فقط صفحه جاری تا رسیدن پاسخ جدید loading نشان میدهد.
|
||
</Text>
|
||
</Box>
|
||
<Button
|
||
size="sm"
|
||
colorScheme="blue"
|
||
onClick={() => simulatePageRequest(transitionPage >= 12 ? 1 : transitionPage + 1)}
|
||
isDisabled={transitionLoading}
|
||
flexShrink={0}
|
||
>
|
||
{transitionLoading ? "در حال دریافت صفحه..." : "صفحه بعدی"}
|
||
</Button>
|
||
</Flex>
|
||
|
||
{renderGrid((level) => (
|
||
<Box w="full" minW={0}>
|
||
<Text mb={2} fontSize="sm" fontWeight="600" dir="ltr">{level}</Text>
|
||
<Pagination
|
||
level={level}
|
||
currentPage={transitionPage}
|
||
totalPages={12}
|
||
totalCount={120}
|
||
pageSize={10}
|
||
loading={transitionLoading}
|
||
onPageChange={simulatePageRequest}
|
||
/>
|
||
</Box>
|
||
))}
|
||
</Box>
|
||
|
||
<Box p={3} bg="gray.50" borderRadius="md" fontSize="sm" color="gray.600">
|
||
ارتفاع Pagination از والد گرفته نمیشود؛ هر variant ارتفاعش را از کنترلها و padding داخلی خودش میسازد.
|
||
</Box>
|
||
</Stack>
|
||
);
|
||
}
|
||
|
||
const NAV_ITEMS = [
|
||
{ id: "app-header", label: "AppHeader" },
|
||
{ id: "app-sidebar", label: "AppSidebar" },
|
||
{ id: "pagination", label: "Pagination" },
|
||
];
|
||
|
||
export default function RemoteUiPreview() {
|
||
const [showBackToTop, setShowBackToTop] = useState(false);
|
||
const [docsEntered, setDocsEntered] = useState(false);
|
||
|
||
useEffect(() => {
|
||
const onScroll = () => {
|
||
setShowBackToTop(window.scrollY > 260);
|
||
setDocsEntered(window.scrollY >= Math.max(1, window.innerHeight * 0.75));
|
||
};
|
||
onScroll();
|
||
window.addEventListener("scroll", onScroll, { passive: true });
|
||
window.addEventListener("resize", onScroll);
|
||
return () => {
|
||
window.removeEventListener("scroll", onScroll);
|
||
window.removeEventListener("resize", onScroll);
|
||
};
|
||
}, []);
|
||
|
||
const scrollTo = (id) => {
|
||
document.getElementById(id)?.scrollIntoView({ behavior: "smooth", block: "start" });
|
||
};
|
||
|
||
return (
|
||
<ChakraProvider>
|
||
<Box minH="100vh" bg="gray.50" dir="rtl" pb={{ base: 20, lg: 8 }}>
|
||
<Box minH="100dvh" display="flex" alignItems="center" justifyContent="center">
|
||
<Container maxW="7xl" px={{ base: 3, md: 6 }} py={{ base: 5, md: 8 }}>
|
||
<SimpleGrid columns={{ base: 1, sm: 3 }} spacing={3}>
|
||
{NAV_ITEMS.map((item) => (
|
||
<Button
|
||
key={item.id}
|
||
type="button"
|
||
h={{ base: "84px", md: "104px" }}
|
||
bg="white"
|
||
color="gray.800"
|
||
borderWidth="1px"
|
||
borderColor="gray.200"
|
||
borderRadius="xl"
|
||
boxShadow="sm"
|
||
fontSize={{ base: "md", md: "lg" }}
|
||
_hover={{ bg: "gray.50", borderColor: "blue.200", transform: "translateY(-2px)" }}
|
||
transition="all .18s ease"
|
||
onClick={() => scrollTo(item.id)}
|
||
>
|
||
{item.label}
|
||
</Button>
|
||
))}
|
||
</SimpleGrid>
|
||
</Container>
|
||
</Box>
|
||
|
||
<Container maxW="7xl" px={{ base: 3, md: 6 }} pb={{ base: 5, md: 8 }}>
|
||
<Stack spacing={6}>
|
||
<DocsSection id="app-header" title="AppHeader"><HeaderDocs /></DocsSection>
|
||
<DocsSection id="app-sidebar" title="AppSidebar"><SidebarDocs allowFixedPreview={docsEntered} /></DocsSection>
|
||
<DocsSection id="pagination" title="Pagination"><PaginationDocs /></DocsSection>
|
||
</Stack>
|
||
</Container>
|
||
|
||
{showBackToTop ? (
|
||
<Button
|
||
type="button"
|
||
position="fixed"
|
||
left={{ base: 4, md: 6 }}
|
||
bottom={{ base: 20, lg: 6 }}
|
||
zIndex={2000}
|
||
size="sm"
|
||
colorScheme="blue"
|
||
boxShadow="lg"
|
||
onClick={() => window.scrollTo({ top: 0, behavior: "smooth" })}
|
||
>
|
||
بازگشت به بالا ↑
|
||
</Button>
|
||
) : null}
|
||
</Box>
|
||
</ChakraProvider>
|
||
);
|
||
}
|