import React , { useEffect , useState } from 'react';
import { Menu } from 'antd';
import Base from './Base';
import Password from './Password';
import './Index.scss';
import '../../SecuritySetting/notice/manager/Index.scss';

function Index(props){
  const { pathname } = props && props.location;


  const [ key , setKey ] = useState("0");

  useEffect(()=>{
    if(pathname){
      if(pathname === `/settings/profile`){
        setKey("0");
      }else{
        setKey("1");
      }
    }
  },[pathname])


  return(
    <div className="notice01">
      <div className="sshHead">
        <Menu mode={'horizontal'} className="infosRightMenu">
          {
            key === "0" ?
            <Menu.Item key="0" className="font-16">基本资料</Menu.Item>
            :
            <Menu.Item key="1" className="font-16">密码管理</Menu.Item>
          }
        </Menu>
      </div>
      <div style={{padding:"20px"}}>
        {
          key === "0" ?
          <Base {...props}/>
          :
          <Password {...props}/>
        }
        
      </div>
    </div>
  )
}
export default Index;