import React from 'react'
import { useRouter } from 'next/navigation'
export default function ProductItem({ num, name, children }) {
  const router = useRouter()

  // 더보기 페이지 이동
  const pageMove = (num) => {
    if (num === 1) {
      router.push('/management/stuff', { scroll: false })
    } else if (num === 2) {
      router.push('/community/notice')
    } else if (num === 3) {
      router.push('/community/faq')
    } else {
      router.push('/community/archive')
    }
  }
  return (
    <div className={`product-item item0${num}`}>
      <div className="product-item-title-wrap">
        <h2 className="product-item-title">
          <span className={`item-logo ico0${num}`}></span>
          {name}
        </h2>
        {num !== 5 && (
          <button
            className="more-btn"
            onClick={() => {
              pageMove(num)
            }}
          ></button>
        )}
      </div>
      <div className="product-item-content">{children}</div>
    </div>
  )
}
