import React from 'react'
import styles from './index.module.scss'
import store from '@/store'
import { EyeOutlined } from '@ant-design/icons'
import { baseURL } from '@/utils/http'

type Props = {
  src: string
}

function YtableVideo({ src }: Props) {
  return (
    <div className={styles.YtableVideo}>
      <div className='TvideoBox'>
        <div
          className='TvideoBoxLook'
          onClick={() =>
            store.dispatch({
              type: 'layout/lookDom',
              payload: { src: baseURL + src, type: 'video', flag: true }
            })
          }
        >
          <EyeOutlined />
          &nbsp;
          <div>预览</div>
        </div>
        <video src={baseURL + src}></video>
      </div>
    </div>
  )
}

const MemoYtableVideo = React.memo(YtableVideo)

export default MemoYtableVideo
