index.jsx 777B

12345678910111213141516171819202122232425262728
  1. import React from "react";
  2. import { Typography } from "antd";
  3. import useRoute from "@/routes/hooks/useRoute";
  4. import { useTranslation } from "react-i18next";
  5. const pageStyle = {
  6. margin: "0 24px 24px 24px",
  7. // margin: '24px',
  8. minHeight: "calc(100% - 24px)",
  9. };
  10. const { Title } = Typography;
  11. export default (props) => {
  12. const router = useRoute() || {};
  13. const style = router.meta.noLayout ? { height: "100%" } : pageStyle;
  14. const title = props.title || router.meta.title;
  15. const { t } = useTranslation();
  16. return (
  17. <div style={style}>
  18. {title && !router.meta.noLayout && (
  19. <Title level={3} style={{ paddingBottom: "12px", fontWeight: 400 }}>
  20. {t(`${router.path}.title`)}
  21. </Title>
  22. )}
  23. {props.children}
  24. </div>
  25. );
  26. };