index.jsx 1.82 KB
Newer Older
wuhao's avatar
wuhao committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
import { Row, Col, Card, Grid } from "antd";
import Mcard from "./mcard";
import Mtable from "./mtable";
const { useBreakpoint } = Grid;

export default (props) => {
  const screens = useBreakpoint();

  return (
    <div className="diycard">
      {screens.xs ? (
        <div
          style={{ display: "flex", flexDirection: "column", height: "100%" }}
        >
          {props.children && (
            <div style={{ marginBottom: 12 }}>{props.children}</div>
          )}
          <div>
            <Mcard {...props} />
          </div>
        </div>
      ) : props.withCard === false ? (
        <div style={{ display: "flex", width: "100%" }}>
wuhao's avatar
wuhao committed
24 25
          {(props.childposition == "left" || !props.childposition) &&
              props.children}
wuhao's avatar
wuhao committed
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
          <div style={{ flex: 1, width: "100%" }}>
            {props.childposition == "top" && props.children}
            <Mtable {...props} />
          </div>
          {(props.childposition == "right" || !props.childposition) &&
            props.children}
        </div>
      ) : (
        <Card
          bordered={props.bordered === false ? false : true}
          style={{ height: "100%" }}
          title={props.pagetitle || null}
          extra={props.pageextra || null}
          activeTabKey={props.activeTabKey}
          tabList={props.tabList}
          onTabChange={props.onTabChange}
        >
          <div style={{ display: "flex", width: "100%" }}>
wuhao's avatar
wuhao committed
44 45
            {(props.childposition == "left" || !props.childposition) &&
              props.children}
wuhao's avatar
wuhao committed
46 47 48 49 50 51 52 53 54 55 56 57
            <div style={{ flex: 1, width: "100%" }}>
              {props.childposition == "top" && props.children}
              <Mtable {...props} />
            </div>
            {(props.childposition == "right" || !props.childposition) &&
              props.children}
          </div>
        </Card>
      )}
    </div>
  );
};