GridContent.tsx 680 Bytes
Newer Older
ι™ˆεΈ…'s avatar
ι™ˆεΈ… committed
1
import React from 'react';
jim's avatar
jim committed
2 3
import { connect } from 'dva';
import styles from './GridContent.less';
ι™ˆεΈ…'s avatar
ι™ˆεΈ… committed
4 5
import ConnectState from '@/models/connect';
import { ContentWidth } from 'config/defaultSettings';
jim's avatar
jim committed
6

ι™ˆεΈ…'s avatar
ι™ˆεΈ… committed
7 8 9 10 11 12
interface GridContentProps {
  contentWidth: ContentWidth;
  children: React.ReactNode;
}

const GridContent = (props: GridContentProps) => {
ι™ˆεΈ…'s avatar
ι™ˆεΈ… committed
13 14 15 16
  const { contentWidth, children } = props;
  let className = `${styles.main}`;
  if (contentWidth === 'Fixed') {
    className = `${styles.main} ${styles.wide}`;
jim's avatar
jim committed
17
  }
ι™ˆεΈ…'s avatar
ι™ˆεΈ… committed
18 19
  return <div className={className}>{children}</div>;
};
jim's avatar
jim committed
20

ι™ˆεΈ…'s avatar
ι™ˆεΈ… committed
21
export default connect(({ setting }: ConnectState) => ({
afc163's avatar
afc163 committed
22
  contentWidth: setting.contentWidth,
jim's avatar
jim committed
23
}))(GridContent);