-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJobs.tsx
77 lines (74 loc) · 2.69 KB
/
Jobs.tsx
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
import React from "react";
import scss from "../scss/jobs.module.scss";
import Link from "next/link";
import dayjs from "dayjs";
import Datefmt from "dayjs/plugin/relativeTime";
import Pagination from "./Pagination";
const Jobs = ({ job, page, loading, hasNextPage, setPage }) => {
dayjs.extend(Datefmt);
return (
<React.Fragment>
<div className={scss.jobwrap}>
<div className={scss.container}>
{loading ? (
<div className={scss.loading}>
<img src="/img/loading.gif" alt="" />
</div>
) : (
<>
<Pagination
page={page}
setPage={setPage}
hasNextPage={hasNextPage}
/>
<div className={scss.jobcontent}>
<div className={scss.wrapjob}>
{job.map((item) => {
return (
<div key={item.id} className={scss.job}>
<span className={scss.jwrap}>
<div className={scss.topwrap}>
<div className={scss.toptext}>
<h2 className={scss.title}>{item.title}</h2>
<p className={scss.company}>
{item.company}
<span className={scss.type}>{item.type}</span>
</p>
<p className={scss.location}>{item.location}</p>
</div>
<div className={scss.company_logo}>
<img
src={
item.company_logo
? item.company_logo
: "/img/nologo.png"
}
alt={item.company}
/>
</div>
</div>
<Link href={`job/${item.id}`}>
<a className={scss.jobBtn}>View Job</a>
</Link>
<p className={scss.date}>
Posted {dayjs().to(dayjs(`${item.created_at}`))}
</p>
</span>
</div>
);
})}
</div>
</div>
<Pagination
page={page}
setPage={setPage}
hasNextPage={hasNextPage}
/>
</>
)}
</div>
</div>
</React.Fragment>
);
};
export default Jobs;