Skip to content

Commit 8b63ecf

Browse files
authored
Merge pull request #58 from stefanv/expired-banner
Add expiration banner
2 parents 8546d4e + 6ca1f61 commit 8b63ecf

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/components/Job.jsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ import jobToMarkdown from "../jobToMarkdown.mjs";
88
const Job = ({ job }) => {
99
const processedJob = React.useMemo(() => jobToMarkdown(job), [job]);
1010

11+
const isExpired = React.useMemo(() => {
12+
if (!processedJob || !processedJob.expires) return false;
13+
const today = new Date();
14+
return new Date(`${processedJob.expires}T23:59:59.999-12:00`) < today;
15+
}, [processedJob]);
16+
1117
if (processedJob === undefined) {
1218
console.log("We don't expect an empty job posting; aborting");
1319
return <div>Empty job posting</div>;
@@ -51,6 +57,11 @@ const Job = ({ job }) => {
5157
</div>
5258
}
5359
</div>
60+
{isExpired && (
61+
<div className="expired-banner">
62+
This job post has expired and is no longer open for applications.
63+
</div>
64+
)}
5465
<div
5566
className="description"
5667
dangerouslySetInnerHTML={{__html: processedJob.description}}

src/styles/global.css

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ li {
2727
a {
2828
color: #2c3e50;
2929
font-weight: bold;
30-
text-decoration: none;
3130
}
3231
.page {
3332
}
@@ -114,8 +113,18 @@ a {
114113
bottom: 1rem;
115114
right: 1rem;
116115
}
116+
.expired-banner {
117+
background-color: #f8d7da;
118+
color: #721c24;
119+
padding: 0.5rem;
120+
margin-bottom: 0.75rem;
121+
margin-top: 1rem;
122+
border-radius: 4px;
123+
text-align: center;
124+
font-weight: bold;
125+
font-size: 0.9rem;
126+
}
117127
.job a {
118-
text-decoration: none;
119128
}
120129
.job .meta a {
121130
font-weight: normal;

0 commit comments

Comments
 (0)