import { Slider } from '@/components/shared/slider/Slider'
import { Media, News, ReviewsSection } from '@/payload-types'
import { getPayload } from 'payload'
import configPromise from '@payload-config'
import { ReviewsCard } from '@/components/shared/cards/reviewsCard'
import { ReviewsSectionClient } from './ReviewsSection.client'

export const ReviewsSectionBlock = async ({ title, subtitle }: ReviewsSection) => {
  const payload = await getPayload({ config: configPromise })

  const result = await payload.find({
    collection: 'reviews',
    limit: 1000,
    pagination: false,
    depth: 2,
  })

  const docs = result.docs as News[]

  return (
    <section className="w-full pl-4 md:pl-16 lg:pl-32 py-30 overflow-hidden bg-base-white">
      <div className="h2 text-base-black">{title}</div>
      <div className="b2-regular text-grey-400">{subtitle}</div>

      <ReviewsSectionClient docs={docs} />
    </section>
  )
}
