import { Heading } from '@/components/Heading/Heading'; import { Paragraph } from '@/components/Paragraph/Paragraph'; import React from 'react'; import * as styles from './CardRole.styles'; import { CardRoleProps } from './CardRole.types'; /** * Format date string to readable format */ function formatDate(dateString: string): string { const date = new Date(dateString); if (isNaN(date.getTime())) return dateString; return date.toLocaleDateString('en-US', { year: 'numeric', month: 'short', }); } export const CardRole: React.FC = ({ role }) => { const startDate = formatDate(role.startDate); const endDate = role.endDate ? formatDate(role.endDate) : 'Present'; const dateRange = `${startDate} — ${endDate}`; return (
{/* Content */}
{/* Company Name (left) and Date (right) */}
{role.company} {dateRange}
{/* Position Title */} {role.position} {/* Description */} {role.description && {role.description}}
); };