import React, { Fragment } from 'react';
import { useLocation } from 'react-router-dom';
import Screen from './Screen';
import State from './State';

import styles from '../index.less';

export default function () {
  const location = useLocation();
  const isStateScreen = /(\/app\/edit\/[0-9]+\/[0-9]+\/panel_[0-9]+\/[0-9]+)|(\/create\/[0-9]+\/panel_[0-9]+\/[0-9]+)$/.test(
    location.pathname
  );
  return (
    <Fragment>
      <div className={styles.title}>页面设置</div>
      <div className={styles.content}>{isStateScreen ? <State /> : <Screen />}</div>
    </Fragment>
  );
}
