import React from 'react';
import { motion } from 'framer-motion';
// --- Icons ---
const BuildingIcon = () => (
);
const LocationIcon = () => (
);
const MoneyIcon = () => (
);
const TrashIcon = () => (
);
const JobCard = ({
id,
title,
company,
logo,
location,
salary,
type,
deadline,
onViewDetails,
onApply,
onWithdraw,
isApplied,
isApplying,
matchPercentage
}) => {
// Determine if the job is expired based on the deadline string
const isExpired = React.useMemo(() => {
if (!deadline || deadline === 'Open') return false;
const deadlineDate = new Date(deadline);
// Normalize today to start of day for fair comparison
const today = new Date();
today.setHours(0, 0, 0, 0);
return deadlineDate < today;
}, [deadline]);
return (
{/* ✅ MATCH PERCENTAGE BADGE */}
{matchPercentage !== undefined && (
= 80
? 'rgba(16, 185, 129, 0.15)'
: matchPercentage >= 60
? 'rgba(251, 191, 36, 0.15)'
: 'rgba(249, 115, 22, 0.15)',
color:
matchPercentage >= 80
? '#34D399'
: matchPercentage >= 60
? '#FBBF24'
: '#FB923C',
border:
matchPercentage >= 80
? '1px solid #10B981'
: matchPercentage >= 60
? '1px solid #FBBF24'
: '1px solid #FB923C'
}}
>
{matchPercentage}% Match
)}
{/* HEADER */}
{logo ? (

) : (
🏢
)}
{/* META */}
{location}
{salary}
{/* FOOTER */}
{type}
Deadline: {deadline}
{/* ACTIONS */}
{isApplied ? (
Applied
) : (
)}
);
};
export default JobCard;