Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | 1x | import React from 'react';
import { Link } from 'react-router-dom';
import { useQuery } from 'react-query';
import axios from 'axios';
import { Building, Users, Globe } from 'lucide-react';
const Employers = () => {
const { data, isLoading } = useQuery('employers', async () => {
const response = await axios.get('/api/employers');
return response.data;
});
if (isLoading) {
return (
<div className="flex items-center justify-center h-64">
<div className="animate-spin rounded-full h-32 w-32 border-b-2 border-primary-600"></div>
</div>
);
}
return (
<div className="space-y-6">
<div>
<h1 className="text-2xl font-bold text-gray-900">Employers</h1>
<p className="mt-1 text-sm text-gray-500">
Browse companies and employers
</p>
</div>
<div className="grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3">
{data?.length > 0 ? (
data.map((employer) => (
<div key={employer.id} className="bg-white shadow rounded-lg">
<div className="px-4 py-5 sm:p-6">
<div className="flex items-start">
<div className="flex-shrink-0">
<div className="h-12 w-12 rounded-full bg-primary-100 flex items-center justify-center">
<Building className="h-6 w-6 text-primary-600" />
</div>
</div>
<div className="ml-4 flex-1">
<h3 className="text-lg font-medium text-gray-900">
<Link to={`/employers/${employer.id}`} className="hover:text-primary-600">
{employer.company_name}
</Link>
</h3>
<p className="text-sm text-gray-500">{employer.first_name} {employer.last_name}</p>
{employer.industry && (
<div className="mt-2 flex items-center text-sm text-gray-500">
<Building className="h-4 w-4 mr-1" />
{employer.industry}
</div>
)}
{employer.company_size && (
<div className="mt-1 flex items-center text-sm text-gray-500">
<Users className="h-4 w-4 mr-1" />
{employer.company_size} employees
</div>
)}
{employer.website && (
<div className="mt-1 flex items-center text-sm text-gray-500">
<Globe className="h-4 w-4 mr-1" />
<a href={employer.website} target="_blank" rel="noopener noreferrer" className="text-primary-600 hover:text-primary-500">
Website
</a>
</div>
)}
{employer.description && (
<div className="mt-3">
<p className="text-sm text-gray-600 line-clamp-3">
{employer.description}
</p>
</div>
)}
</div>
</div>
</div>
</div>
))
) : (
<div className="col-span-full text-center py-12">
<Building className="mx-auto h-12 w-12 text-gray-400" />
<h3 className="mt-2 text-sm font-medium text-gray-900">No employers found</h3>
<p className="mt-1 text-sm text-gray-500">
No employers have registered yet.
</p>
</div>
)}
</div>
</div>
);
};
export default Employers;
|