Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import React from 'react';
  2. import { Flex, Layout, Row, Col } from 'antd';
  3. import Navigation from '@/components/layout/Navigation';
  4. // This layout component is an alternative layout for Next.js routes
  5. // where the default layout from app/layout.tsx is intentionally skipped.
  6. // It is useful when you define certain paths to avoid the global layout (e.g., login pages, special full-screen pages).
  7. type AltLayoutProps = {
  8. header?: React.ReactNode; // Optional header component
  9. children?: React.ReactNode; // Main content of the page
  10. footer?: React.ReactNode; // Optional footer component (defaults to <Navigation />)
  11. };
  12. // Functional component definition with default props set
  13. const AltLayout: React.FC<AltLayoutProps> = ({
  14. header = <></>, // Empty fragment by default if no header passed
  15. children = <></>, // Empty fragment by default if no children passed
  16. footer = <Navigation /> // Defaults to Navigation if no footer is passed
  17. }: AltLayoutProps) => {
  18. return (
  19. // Top-level Layout from Ant Design
  20. <Layout className="!w-full !max-w-[430px] !mx-auto !relative !bg-white">
  21. {/* Full vertical height flex container */}
  22. <Flex vertical className="!h-screen">
  23. {/* Header Row (if provided) */}
  24. <Row>
  25. <Col span={24}>
  26. {header}
  27. </Col>
  28. </Row>
  29. {/* Content Row: grows to take available space, scrollable vertically only */}
  30. <Row className="flex-1 overflow-y-scroll overflow-x-hidden">
  31. <Col span={24}>
  32. <Flex vertical className="!bg-white">
  33. {/* Content wrapper - handles chat body or main content scroll */}
  34. <div className="flex-1 overflow-y-auto">
  35. {children}
  36. </div>
  37. </Flex>
  38. </Col>
  39. </Row>
  40. {/* Footer section - typically bottom navigation */}
  41. {/* Whatever you do, don't change this div, I don't know why it works, but it works, trust me I already to antd this shit */}
  42. <div>
  43. {footer}
  44. </div>
  45. </Flex>
  46. </Layout>
  47. );
  48. };
  49. export default AltLayout;