import { PATHS } from '@/shared/constants/paths';
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
import { NoticeItemProps } from '../model/types';
import moment from 'moment';

export const SupportNoticeItem = ({
  id,
  title,
  category,
  regDate,
  isNew
}: NoticeItemProps) => {
  const { navigate } = useNavigate();

  const onClickToDetail = () => {
    navigate(PATHS.support.notice.detail, {
      state: {
        id: id,
        from: PATHS.support.notice.list
      }
    })
  };

  return (
    <>
      <div 
        className="notice-row-114"
        onClick={ () => onClickToDetail() }
      >
        <div className="notice-txt">
          <div className="notice-title-114">{ title }</div>
          <div className="notice-meta-114">
            <span className="blue">{ category }</span> ㅣ <span>{ moment(regDate).format('YYYY.MM.DD HH:mm:ss') }</span>
          </div>
        </div>
      </div>
    </>
  );
};