import React, { useState } from 'react';
import { Menu } from 'antd';
import "./branch.scss";
import CopyTool from '../Component/CopyTool';

function CloneAddress({http_url , ssh_url , zip_url , tar_url}) {
  const [ key , setKey ] = useState("HTTP");
  return (
    <div className="downMenu">
      <div style={{borderBottom:"1px solid #eee"}}>
        <Menu className="urlMenu" selectedKeys={[key]} mode={"horizontal"}>
          <Menu.Item key="HTTP" onClick={(e)=>{setKey(e.key)}}>HTTP</Menu.Item>
          <Menu.Item key="SSH" onClick={(e)=>{setKey(e.key)}}>SSH</Menu.Item>
        </Menu>
        <div className="gitAddressClone">
          <input type="text" id="copy_rep_content" value={key==="HTTP" ? http_url:ssh_url} />
          <CopyTool inputId="copy_rep_content" className="copytool"/>
        </div>
      </div>
      <Menu className="edu-txt-center">
        <Menu.Item><a href={zip_url}>下载 ZIP</a></Menu.Item>
        <Menu.Item><a href={tar_url}>下载 TAR.GZ</a></Menu.Item>
      </Menu>
    </div>
  )
}
export default CloneAddress;