import Link from 'next/link'
import React from 'react'
import { useCart } from '../../context/CartProvider'

export default function BuyingOptions({product}) {
    const {addToCart} = useCart()
    const {id, slug} = product
    const addProduct =()=>{
        addToCart(product,1)
    }
  return (
    <div><button
    className="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
    href={{
      pathname: `/products/${id}`,
      query: {product:slug}
    }}
    onClick={addProduct}
  >
    Add to Cart
  </button>{" "}</div>
  )
}
