import React from 'react';
import './index.less';

function Assets(props) {
  const { name, src, className = '', svg, onClick } = props;
  if (!name && !src) return <img />;
  return (
    <img
      className={`assets ${className} ${!(!name && !src) || 'hide'}`}
      src={src || `/assets/${name}.${svg ? 'svg' : 'png'}`}
      onClick={() => onClick && onClick()}
    />
  );
}
export default Assets;
