--- import WidgetWrapper from '~/components/ui/WidgetWrapper.astro'; import Headline from '~/components/ui/Headline.astro'; import { Icon } from 'astro-icon/components'; import type { Widget } from '~/types'; export interface Props extends Widget { title?: string; subtitle?: string; tagline?: string; compact?: boolean; items?: Array<{ title: string; description?: string; company?: string; date?: string; location?: string; icon?: string; classes?: Record; }>; } const { title = 'Work Experience', subtitle = 'My professional journey', tagline = '', compact = false, items = [], id, isDark = false, classes = {}, bg = '', } = Astro.props as Props; // Function to get gradient based on company or role const getWorkGradient = (company: string = '', title: string = '') => { const companyLower = company.toLowerCase(); const titleLower = title.toLowerCase(); if (companyLower.includes('cofra')) return 'from-blue-600 to-indigo-700'; if (companyLower.includes('hyva')) return 'from-green-600 to-teal-700'; if (companyLower.includes('bergsma')) return 'from-purple-600 to-pink-700'; if (companyLower.includes('allseas')) return 'from-orange-600 to-red-700'; if (companyLower.includes('oz export')) return 'from-cyan-600 to-blue-700'; // Fallback based on role level if (titleLower.includes('manager')) return 'from-indigo-600 to-purple-700'; if (titleLower.includes('professional')) return 'from-blue-600 to-cyan-700'; if (titleLower.includes('engineer')) return 'from-green-600 to-blue-700'; if (titleLower.includes('consultant')) return 'from-purple-600 to-indigo-700'; if (titleLower.includes('administrator')) return 'from-gray-600 to-slate-700'; return 'from-gray-600 to-gray-700'; }; // Function to get appropriate icon const getWorkIcon = (title: string = '') => { const titleLower = title.toLowerCase(); if (titleLower.includes('manager')) return 'tabler:user-star'; if (titleLower.includes('professional')) return 'tabler:certificate'; if (titleLower.includes('engineer')) return 'tabler:code'; if (titleLower.includes('consultant')) return 'tabler:user-check'; if (titleLower.includes('administrator')) return 'tabler:settings'; return 'tabler:briefcase'; }; // Function to extract years from date range const getYearRange = (dateStr: string = '') => { if (!dateStr) return ''; // Handle formats like "02-2025 - Present" or "04-2018 - 09-2018" const match = dateStr.match(/(\d{2})-(\d{4})\s*-\s*(.+)/); if (match) { const startYear = match[2]; const endPart = match[3].trim(); if (endPart.toLowerCase().includes('present') || endPart.toLowerCase().includes('heden')) { return `${startYear} - Present`; } else { const endMatch = endPart.match(/(\d{2})-(\d{4})/); if (endMatch) { return `${startYear} - ${endMatch[2]}`; } } } return dateStr; }; ---
{items.map((item, index) => { const gradient = getWorkGradient(item.company, item.title); const icon = getWorkIcon(item.title); const yearRange = getYearRange(item.date); return (

{item.title}

{item.company && (

{item.company}

)}
{yearRange && ( {yearRange} )} {item.location && ( {item.location} )}
{item.description && (

{item.description}

Tap to read more
)}
); })}