'use client'
import { Fragment } from 'react'
import { useRecoilValue } from 'recoil'
import { popupState } from '@/store/popupAtom'

/**
 * 팝업 관리자
 */
export default function PopupManager() {
  const popup = useRecoilValue(popupState)

  return [
    ...popup?.config.map((child) => <Fragment key={child.id}>{child.component}</Fragment>),
    ...popup?.other.map((child) => <Fragment key={child.id}>{child.component}</Fragment>),
  ]
}
