'use client' import IconButton from '@/components/ui/IconButton' import Typography from '@/components/ui/Typography' import { useAppDispatch } from '@/hooks/useAppDispatch' import { useAppSelector } from '@/hooks/useAppSelector' import { removeAlert } from '@/state/feedbackSlice' import { css } from '@/styled-system/css' import { alert } from '@/styled-system/recipes/alert' import { faTimes } from '@fortawesome/free-solid-svg-icons' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { AnimatePresence, motion } from 'framer-motion' import { type FC } from 'react' import { createPortal } from 'react-dom' const FeedbackConsumer: FC = () => { const { alerts } = useAppSelector(state => state.feedback) const dispatch = useAppDispatch() return ( <> {alerts.length > 0 && createPortal( ( {alerts.map((currentAlert) => ( dispatch(removeAlert(currentAlert.id))} > {currentAlert.title} {currentAlert.message} ))} ), document.body, 'alerts' )} ) } export default FeedbackConsumer