import React, { useEffect } from 'react';
import styles from './index.less';

import { useModel, history } from 'umi';

type PageHeaderProps = {
  title: React.ReactNode;
  action: React.ReactNode;
};
const PageHeader: React.FC<PageHeaderProps> = ({ title, action }) => {
  //console.log('PageHeader');

  useEffect(() => {
    //debugger
    const unlisten = history.listen((location, action) => {
      console.log('location,action', location, action);
    });
    return () => {
      //console.log('un--PageHeader--useEffect');
      unlisten();
    };
  }, []);
  return (
    <>
      <div className={styles.navHeader}>
        <div className={styles.title}>{title}</div>
        {action}
      </div>
    </>
  );
};

export default PageHeader;
