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')
    } else if (num === 2) {
      router.push('/community/notice')
    } else {
      router.push('/community/faq')
    }
  }
  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 !== 4 && num !== 5 && (
          <button
            className="more-btn"
            onClick={() => {
              pageMove(num)
            }}
          ></button>
        )}
      </div>
      <div className="product-item-content">{children}</div>
    </div>
  )
}
