import React from 'react';
import { Typography } from 'antd';
import useRoute from '@/routes/hooks/useRoute';

const pageStyle = {
  margin: '0 24px 24px 24px',
  // margin: '24px',
  minHeight: 'calc(100% - 24px)',
}
const { Title } = Typography;

export default (props) => {
  const { meta = {} } = useRoute() || {};
  const style = meta.noLayout ? { height: '100%' } : pageStyle;
  const title = props.title || meta.title;

  return (
    <div style={style}>
      { title && !meta.noLayout && <Title level={3} style={{ paddingBottom: '12px', fontWeight: 400 }}>{ title }</Title> }
      {props.children}
    </div>
  )
}