import React from 'react'
import useTheme from '../use-theme'
import withDefaults from '../utils/with-defaults'

interface Props {
  color?: string
  width?: number
  height?: number
}

const defaultProps = {
  width: 16,
  height: 16
}

export type TreeLeafIconProps = Props & typeof defaultProps

const TreeLeafIcon: React.FC<TreeLeafIconProps> = ({ color, width, height }) => {
  const theme = useTheme()
  return (
    <svg
      viewBox="0 0 24 24"
      width={width}
      height={height}
      stroke="currentColor"
      strokeWidth="1"
      strokeLinecap="round"
      strokeLinejoin="round"
      fill="none"
      shapeRendering="geometricPrecision"
    >
      <path d="M13 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V9z" />
      <path d="M13 2v7h7" />
      <style jsx>{`
        svg {
          color: ${color || theme.palette.accents_12};
        }
      `}</style>
    </svg>
  )
}

const MemoTreeLeafIcon = React.memo(TreeLeafIcon)

export default withDefaults(MemoTreeLeafIcon, defaultProps)
