Convert NotificationCard to Typescript

This commit is contained in:
T'JAMPENS QUENTIN p2406187
2026-03-18 20:58:30 +01:00
parent 5787f941fd
commit 724ae99b29
3 changed files with 16 additions and 12 deletions
@@ -0,0 +1,38 @@
import formatDate from "../../utils/date/formatDate.js";
import formatTime from "../../utils/date/formatTime.js";
import styles from "./NotificationCard.module.css"
import Notification from "../../interfaces/notification.interface";
interface NotificationCardProps {
notifications: Notification[];
deleteNotification: (id: number) => void;
}
function NotificationCard({ notifications, deleteNotification }: NotificationCardProps) {
return (
notifications.map((notification, index) => (
<div className={styles.notificationCard} key={index}>
<div className={styles.cardHeader}>
<span className={styles.timeTag}>
Le {formatDate(String(notification.created_at))} à {formatTime(String(notification.created_at))}
</span>
<button
className={styles.closeIconButton}
onClick={() => deleteNotification(notification.id)}
title="Supprimer"
>
</button>
</div>
<div className={styles.cardContent}>
<p className={styles.message}>
{notification.content}
</p>
</div>
</div>
))
);
}
export default NotificationCard;