Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a job opportunity feature #183

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/gdg-website.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 58 additions & 0 deletions src/app/(pages)/careers/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,61 @@ const CareerPage = () => {
};

export default CareerPage;


import React, { useEffect, useState } from 'react';

const Spotlight = () => {
const [spotlightJobs, setSpotlightJobs] = useState([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);

useEffect(() => {
const fetchJobs = async () => {
try {
const response = await fetch('/api/jobs');
if (!response.ok) throw new Error('Network response was not ok');
const data = await response.json();
setSpotlightJobs(data);
} catch (error) {
setError(error);
} finally {
setLoading(false);
}
};

fetchJobs();
}, []);

if (loading) return <p>Loading...</p>;
if (error) return <p>Error loading jobs: {error.message}</p>;

return (
<div className="mt-16 flex flex-col items-center">
<h2 className="text-3xl font-semibold mb-6">Spotlight</h2>
<div className="flex space-x-4 overflow-x-auto pb-4">
{spotlightJobs.map((job, index) => (
<div key={index} className="bg-white shadow-md rounded-lg p-4 w-72">
<img src={job.image} alt={job.title} className="rounded-t-lg w-full h-40 object-cover" />
<div className="mt-4">
<h3 className="font-bold text-xl">{job.title}</h3>
<p className="mt-2 text-gray-600">{job.description}</p>
{job.location && (
<div className="mt-4 flex items-center space-x-2 text-gray-500">
<span className="material-icons">laptop_mac</span>
<span>{job.location}</span>
</div>
)}
{job.office && (
<div className="mt-2 flex items-center space-x-2 text-gray-500">
<span className="material-icons">location_on</span>
<span>{job.office}</span>
</div>
)}
</div>
</div>
))}
</div>
</div>
);
};