Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

AltLayout.tsx 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 px-4 py-6 space-y-4">
  35. {children}
  36. </div>
  37. </Flex>
  38. </Col>
  39. </Row>
  40. {/* Footer section - typically bottom navigation */}
  41. <div>
  42. {footer}
  43. </div>
  44. </Flex>
  45. </Layout>
  46. );
  47. };
  48. export default AltLayout;