'use client'

import React from 'react'
import { useAppSelector } from '@/lib/redux-hooks'
import SearchForm from '../../search-form'

const Banner: React.FC = () => {
  const merchant = useAppSelector((state) => state.merchant)

  return (
    <section
      className={`bg-gray-100 w-full min-h-[450px] bg-no-repeat bg-cover bg-center relative py-10  sm:py-20`}
      style={{
        backgroundImage: `url(${merchant?.page_settings?.banner.coverImage})`,
      }}
    >
      <div className="max-w-7xl px-5 sm:px-10 relative z-2 mx-auto">
        <h1 className="text-2xl lg:text-4xl font-bold text-white">
          {merchant?.page_settings?.banner?.headline}
        </h1>
        <p className="text-sm lg:text-base text-white mt-4">
          {merchant?.page_settings?.banner?.headlineDescription}
        </p>
      </div>

      <div className="max-w-7xl px-5 sm:px-10 mx-auto p-4 relative mt-8 z-2">
        <div className="bg-white rounded-lg shadow-sm p-6 pb-8">
          <SearchForm />
        </div>
      </div>

      <div className="bg-black/30 absolute top-0 left-0 bottom-0 right-0 width-full height-full"></div>
    </section>
  )
}

export default Banner
