-
Notifications
You must be signed in to change notification settings - Fork 329
/
Copy pathJobListing.jsx
51 lines (42 loc) · 1.54 KB
/
JobListing.jsx
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
import { useState } from 'react';
import { FaMapMarker } from 'react-icons/fa';
import { Link } from 'react-router-dom';
const JobListing = ({ job }) => {
const [showFullDescription, setShowFullDescription] = useState(false);
let description = job.description;
if (!showFullDescription) {
description = description.substring(0, 90) + '...';
}
return (
<div className='bg-white rounded-xl shadow-md relative'>
<div className='p-4'>
<div className='mb-6'>
<div className='text-gray-600 my-2'>{job.type}</div>
<h3 className='text-xl font-bold'>{job.title}</h3>
</div>
<div className='mb-5'>{description}</div>
<button
onClick={() => setShowFullDescription((prevState) => !prevState)}
className='text-indigo-500 mb-5 hover:text-indigo-600'
>
{showFullDescription ? 'Less' : 'More'}
</button>
<h3 className='text-indigo-500 mb-2'>{job.salary} / Year</h3>
<div className='border border-gray-100 mb-5'></div>
<div className='flex flex-col lg:flex-row justify-between mb-4'>
<div className='text-orange-700 mb-3'>
<FaMapMarker className='inline text-lg mb-1 mr-1' />
{job.location}
</div>
<Link
to={`/jobs/${job.id}`}
className='h-[36px] bg-indigo-500 hover:bg-indigo-600 text-white px-4 py-2 rounded-lg text-center text-sm'
>
Read More
</Link>
</div>
</div>
</div>
);
};
export default JobListing;