11---
22import CardContent from " @components/CardContent.astro" ;
3- const { job, sponsor } = Astro .props ;
3+ import { getEntry } from " astro:content" ;
4+ const { job :jobId, sponsor :sponsorId } = Astro .props ;
45
5- // TODO: add tags
6- const { title, location, type, level, salary, description, responsibilities, requirements, benefits, apply_link } = job .data ;
6+ const job = await getEntry (" jobs" , jobId );
7+ if (! job ) {
8+ throw new Error (` Job with ID "${jobId }" not found ` );
9+ }
10+
11+ const sponsor = await getEntry (" sponsors" , sponsorId );
712
13+ if (! sponsor ) {
14+ throw new Error (` Sponsor with ID "${sponsorId }" not found ` );
15+ }
816
17+ // TODO: add tags
18+ const { title, location, type, level, salary, description, responsibilities, requirements, benefits, apply_link, draft } = job .data ;
919
20+ const isJobPage = Astro .url .pathname == ` /sponsor/${job .id } ` ;
1021---
1122
12- <div class =" mb-6 last:mb-0" >
13- <div class =" flex-1 p-6 rounded-lg shadow-md bg-white " >
14- <a href ={ ` /sponsor/${job . id } ` } >
23+ <div class =" mb-6 last:mb-0 rounded-lg shadow-md bg-white " >
24+ <div class =` flex-1 p-6 ${ draft ? " draft " : " " }` >
25+ <a href ={ ` /sponsor/${jobId } ` } >
1526 <h2 class =" text-3xl font-bold mb-2" >{ title } </h2 >
1627 </a >
1728
@@ -23,7 +34,7 @@ const { title, location, type, level, salary, description, responsibilities, req
2334 <p class = " text-gray-600 mb-2" >{ level } • { type } • { location } </p >
2435 }
2536 <p class =" text-gray-700 mb-4" >{ salary } </p >
26- <p class =" mb-6 " >{ description } </p >
37+ <p class =" mb-3 " >{ description } </p >
2738
2839 { responsibilities &&
2940 <h3 class = " text-xl font-semibold mb-2" >Responsibilities</h3 >
@@ -46,9 +57,6 @@ const { title, location, type, level, salary, description, responsibilities, req
4657 </ul >
4758 }
4859
49-
50- <CardContent entry ={ job } />
51-
5260 <a
5361 href ={ apply_link }
5462 target =" _blank"
@@ -84,4 +92,5 @@ const { title, location, type, level, salary, description, responsibilities, req
8492 color: var(--color-primary-hover);
8593 text-decoration: underline;
8694 }
95+
8796</style >
0 commit comments