import React from 'react'
import Green_Btn from '../common_btn/green_btn/Green_Btn'
import './Common_Back_Header.css'
import { useNavigate } from 'react-router-dom'

const Common_Back_Header = ({backNavigation,showReOrder}) => {

    const navigate = useNavigate()

    return (
        <section className='Common_Back_Header'>
            <p className='back_text' onClick={() => {
          if (typeof backNavigation === "number") {
            navigate(backNavigation);
          } else {
            navigate(backNavigation || "/");
          }
        }}>Back</p>

            {showReOrder && (
                <div className='btn_holder' onClick={() => {navigate("/cart")}}>
                    <Green_Btn btn_name="Reorder" />
                </div>
            )}


        </section>
    )
}

export default Common_Back_Header
