Files
srbhr 29792ff907 feat(resume): add modern template with accent colors
- Introduced a new "modern" resume template with customizable accent colors.
- Updated type definitions to include the new template and accent color options.
- Implemented date formatting utility for consistent date range display.
- Enhanced existing resume components to support the new template.
- Adjusted CSS styles for better layout and readability across templates.
- Added documentation for adding new resume templates to guide future development.
2026-01-06 15:28:08 +05:30

51 lines
1.8 KiB
TypeScript

import { type ClassValue, clsx } from 'clsx';
/**
* Combines multiple class names or class name objects into a single string.
* Uses clsx for conditional class logic.
*
* @param inputs - Class values to be combined (strings, objects, arrays)
* @returns A string of combined class names
*/
export function cn(...inputs: ClassValue[]): string {
return clsx(inputs);
}
/**
* Formats a date range string with a hyphen separator for ATS compatibility.
* Uses ASCII hyphen-minus (-) instead of en-dash for reliable PDF text extraction.
*
* Handles various input formats:
* - "Jun 2025 Aug 2025" → "Jun 2025 - Aug 2025"
* - "Jun 2025 - Aug 2025" → "Jun 2025 - Aug 2025"
* - "2023 2025" → "2023 - 2025"
* - "Present" → "Present" (no change for single dates)
*
* @param dateString - The date range string to format
* @returns Formatted date string with hyphen separator
*/
export function formatDateRange(dateString: string | undefined | null): string {
if (!dateString) return '';
// Normalize any existing dashes (en-dash, em-dash) to hyphen-minus for ATS compatibility
let formatted = dateString.replace(/[–—]/g, '-');
// Normalize spacing around existing hyphens
formatted = formatted.replace(/\s*-\s*/g, ' - ');
// Handle "Jun 2025 Aug 2025" pattern (month year month year without separator)
// Match: word/abbrev + 4-digit year + space + word/abbrev + 4-digit year
formatted = formatted.replace(/([A-Za-z]+\.?\s+\d{4})\s+([A-Za-z]+\.?\s+\d{4})/g, '$1 - $2');
// Handle "2023 2025" pattern (year year without separator)
formatted = formatted.replace(/(\d{4})\s+(\d{4})/g, '$1 - $2');
// Handle "Jun 2025 Present" pattern
formatted = formatted.replace(
/([A-Za-z]+\.?\s+\d{4})\s+(Present|Current|Now|Ongoing)/gi,
'$1 - $2'
);
return formatted;
}