Skip to content

Commit

Permalink
add responsive (code100x#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
pratiiikkk authored Sep 1, 2024
1 parent 0401a3b commit 3c76bef
Show file tree
Hide file tree
Showing 12 changed files with 212 additions and 143 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@
"@radix-ui/react-dialog": "^1.1.1",
"@radix-ui/react-dropdown-menu": "^2.1.1",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-popover": "^1.1.1",
"@radix-ui/react-radio-group": "^1.2.0",
"@radix-ui/react-scroll-area": "^1.1.0",
"@radix-ui/react-select": "^2.1.1",
"@radix-ui/react-separator": "^1.1.0",
"@radix-ui/react-slider": "^1.2.0",
"@radix-ui/react-popover": "^1.1.1",
"@radix-ui/react-slot": "^1.1.0",
"dayjs": "^1.11.13",
"@radix-ui/react-switch": "^1.1.0",
"@radix-ui/react-toast": "^1.2.1",
"@types/lodash": "^4.17.7",
"@uidotdev/usehooks": "^2.4.1",
"bcryptjs": "^2.4.3",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"dayjs": "^1.11.13",
"lodash": "^4.17.21",
"lucide-react": "^0.426.0",
"next": "14.2.5",
Expand All @@ -51,6 +51,7 @@
"react-icons": "^5.2.1",
"tailwind-merge": "^2.4.0",
"tailwindcss-animate": "^1.0.7",
"vaul": "^0.9.1",
"zod": "^3.23.8",
"zod-error": "^1.5.0"
},
Expand Down
6 changes: 4 additions & 2 deletions src/app/jobs/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ const page = async ({ searchParams }: { searchParams: JobQuerySchemaType }) => {
}
const parsedSearchParams = parsedData.data;
return (
<div className="container flex gap-5 pt-5">
<JobFilters searchParams={parsedSearchParams} />
<div className="container flex gap-5 pt-5 mt-10">
<div className="hidden sm:block border h-fit rounded-lg w-[310px] ">
<JobFilters searchParams={parsedSearchParams} />
</div>
<div className="grow">
<JobsHeader searchParams={parsedSearchParams} />
<Suspense
Expand Down
6 changes: 3 additions & 3 deletions src/components/HalfCircleGradient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ export default function HalfCircleGradient({ position }: { position: string }) {
return (
<div
className={cn(
'absolute left-1/2 transform -translate-x-1/2 w-[90%] blur-[130px] bg-no-repeat -z-10',
'absolute left-1/2 transform -translate-x-1/2 w-[100%] sm:w-[90%] blur-[130px] bg-no-repeat -z-10',
{
'-top-28 bg-gradient-to-b from-[#2563EB]/40 to-[#3672E3]/20 rounded-b-full h-[500px]':
'-top-52 sm:-top-32 bg-gradient-to-b from-[#2563EB]/40 to-[#3672E3]/20 rounded-b-full h-[420px]':
position === 'top',
'bottom-3 bg-gradient-to-t from-[#2563EB]/40 to-[#3672E3]/20 rounded-t-full h-[700px] overflow-hidden':
'sm:bottom-0 bg-gradient-to-t from-[#2563EB]/40 to-[#3672E3]/20 rounded-t-full h-[500px] overflow-hidden':
position === 'bottom',
}
)}
Expand Down
4 changes: 2 additions & 2 deletions src/components/all-jobs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ const AllJobs = async ({ searchParams }: PaginatorProps) => {
DEFAULT_PAGE;
const currentPage = parseInt(searchParams.page?.toString()) || DEFAULT_PAGE;
return (
<div className="bg-background py-4 grid gap-3">
<div className="bg-background py-4 grid gap-3 w-full">
{jobs.additional?.jobs.map((job) => {
return (
<Link key={job.id} href={`/jobs/${job.id}`}>
<div
className="w-full flex flex-col items-start gap-4 rounded-lg border p-3 text-left text-sm transition-all hover:bg-accent"
className="w-[94%] mx-auto flex flex-col items-start gap-4 rounded-lg border p-3 text-left text-sm transition-all hover:bg-accent"
key={job.id}
>
<div className="flex w-full flex-col gap-2">
Expand Down
6 changes: 3 additions & 3 deletions src/components/hero-section.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { GITHUB_REPO } from '@/lib/constant/app.constant';
import Link from 'next/link';
import Icon from './ui/icon';
import { MarqueeDemo } from './infinitescroll';
import { LogoMarquee } from './infinitescroll';

const HeroSection = () => {
return (
<>
<section className="relative max-sm:pt-10 container">
<section className="relative sm:py-10 container">
<div className="flex flex-col gap-4 items-center justify-center py-8 md:py-12 md:pb-8 lg:py-12 lg:pb-10">
<Link
href={GITHUB_REPO}
Expand Down Expand Up @@ -35,7 +35,7 @@ const HeroSection = () => {
</div>
</div>
</div>
<MarqueeDemo />
<LogoMarquee />
</section>
</>
);
Expand Down
131 changes: 24 additions & 107 deletions src/components/infinitescroll.tsx
Original file line number Diff line number Diff line change
@@ -1,115 +1,32 @@
import React from 'react';
import Marquee from './ui/Marquee';
import Image from 'next/image';
// import Marquee from "@/components/magicui/marquee";

const reviews = [
{
name: 'Jack',
username: '@jack',
body: "I've never seen anything like this before. It's amazing. I love it.",
img: 'https://avatar.vercel.sh/jack',
},
{
name: 'Jill',
username: '@jill',
body: "I don't know what to say. I'm speechless. This is amazing.",
img: 'https://avatar.vercel.sh/jill',
},
{
name: 'John',
username: '@john',
body: "I'm at a loss for words. This is amazing. I love it.",
img: 'https://avatar.vercel.sh/john',
},
{
name: 'Jane',
username: '@jane',
body: "I'm at a loss for words. This is amazing. I love it.",
img: 'https://avatar.vercel.sh/jane',
},
{
name: 'Jenny',
username: '@jenny',
body: "I'm at a loss for words. This is amazing. I love it.",
img: 'https://avatar.vercel.sh/jenny',
},
{
name: 'James',
username: '@james',
body: "I'm at a loss for words. This is amazing. I love it.",
img: 'https://avatar.vercel.sh/james',
},
];
import Marquee from './ui/Marquee';

const imageList = [
{
id: 1,
src: './microsoft.svg',
},
{
id: 2,
src: './solana.svg',
},
{
id: 3,
src: './google.svg',
},
const logos = [
{ src: '/microsoft.svg', alt: 'Microsoft', width: 190, height: 50 },
{ src: '/google.svg', alt: 'Google', width: 140, height: 25 },
{ src: '/solana.svg', alt: 'Solana', width: 180, height: 50 },
// Add more logos here
];

const firstRow = reviews.slice(0, reviews.length / 2);

const ReviewCard = ({}) => {
export function LogoMarquee() {
return (
<div className="flex flex-row items-center justify-evenly overflow-hidden md:shadow-xl">
{imageList.concat(imageList).map((item, index) => {
return (
<Image
className="ml-10"
src={item.src}
alt="companies"
width={200}
height={100}
key={index}
/>
);
})}
</div>
);
};

export function MarqueeDemo() {
return (
<div className="w-screen relative flex flex-row h-[200px] w-full flex-col items-center justify-center overflow-hidden md:w-full">
<Marquee pauseOnHover className="[--duration:50s]">
{firstRow.map((review) => (
<ReviewCard key={review.username} {...review} />
))}
</Marquee>

{/* <div className="pointer-events-none absolute inset-y-0 left-0 w-1/3 bg-gradient-to-r from-white dark:from-background"></div>
<div className="pointer-events-none absolute inset-y-0 right-0 w-1/3 bg-gradient-to-l from-white dark:from-background"></div> */}
<div className="relative flex items-center justify-center ">
<div className="mt-14 sm:mt-24 mb-10 relative flex mx-auto w-[80vw] sm:w-[75vw] items-center justify-center overflow-hidden ">
<Marquee className="[--duration:20s]">
{logos.map((logo) => (
<div key={logo.alt} className="px-4 flex items-center">
<Image
src={logo.src}
alt={logo.alt}
width={logo.width}
height={logo.height}
/>
</div>
))}
</Marquee>
<div className="pointer-events-none absolute inset-y-0 left-0 w-1/3 bg-gradient-to-r dark:from-neutral-950"></div>
<div className="pointer-events-none absolute inset-y-0 right-0 w-1/3 bg-gradient-to-l dark:from-neutral-950"></div>
</div>
</div>
);
}

// <figure
// className={cn(
// 'relative w-64 cursor-pointer overflow-hidden rounded-xl border p-4',
// // light styles
// 'border-gray-950/[.1] bg-gray-950/[.01] hover:bg-gray-950/[.05]',
// // dark styles
// 'dark:border-gray-50/[.1] dark:bg-gray-50/[.10] dark:hover:bg-gray-50/[.15]'
// )}
// >
// {imageList.concat(imageList).map((item, index) => (
// <Image
// className="ml-10"
// src={item.src}
// alt="companies"
// width={200}
// height={100}
// key={index}
// />
// ))}
// </figure>
27 changes: 18 additions & 9 deletions src/components/job-landing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import JobCardLoader from '@/components/job-card-loader';
import { DEFAULT_PAGE, JOBS_PER_PAGE } from '@/config/app.config';
import JobsHeader from '@/layouts/jobs-header';
import { Suspense } from 'react';
import { JobQuerySchemaType } from '@/lib/validators/jobs.validator';
import {
JobQuerySchema,
JobQuerySchemaType,
} from '@/lib/validators/jobs.validator';
import { Pagination, PaginationContent, PaginationItem } from './ui/pagination';
import {
PaginationNextButton,
Expand All @@ -17,6 +20,7 @@ import APP_PATHS from '@/config/path.config';

import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import { redirect } from 'next/navigation';
dayjs.extend(relativeTime);

export const calculateTimeSincePosted = (postedAt: Date): string => {
Expand All @@ -28,12 +32,18 @@ export const JobLanding = async ({
}: {
searchParams: JobQuerySchemaType;
}) => {
const parsedData = JobQuerySchema.safeParse(searchParams);
if (!(parsedData.success && parsedData.data)) {
console.error(parsedData.error);
redirect('/');
}
const parsedSearchParams = parsedData.data;
return (
<div className="max-w-screen-lg mx-auto grid grid-cols-1 gap-6 py-8 pt-10">
<div className="grow px-5">
<JobsHeader searchParams={searchParams} />
<div className="max-w-screen-lg mx-auto grid grid-cols-1 gap-6 py-8 pt-10 ">
<div className="space-y-5">
<JobsHeader searchParams={parsedSearchParams} />
<Suspense fallback={<JobCardLoader />}>
<JobCard searchParams={searchParams} />
<JobCard searchParams={parsedSearchParams} />
</Suspense>
</div>
</div>
Expand All @@ -55,12 +65,12 @@ const JobCard = async ({ searchParams }: PaginatorProps) => {
DEFAULT_PAGE;
const currentPage = parseInt(searchParams.page?.toString()) || DEFAULT_PAGE;
return (
<div className=" py-4 grid gap-3">
<div className="grid gap-3 sm:px-5 ">
{jobs.additional?.jobs.map((job) => {
return (
<Link key={job.id} href={`/jobs/${job.id}`}>
<div
className=" dark:bg-neutral-900 bg-background w-full flex flex-col md:flex-row md:items-center items-start gap-4 rounded-3xl border p-5 px-6 text-left text-sm transition-all hover:bg-accent"
className=" dark:bg-neutral-900 bg-background mx-auto w-[94%] sm:w-full flex flex-col md:flex-row md:items-center items-start gap-4 rounded-3xl border p-5 overflow-hidden text-left text-sm transition-all hover:bg-accent"
key={job.id}
>
<div>
Expand All @@ -85,7 +95,6 @@ const JobCard = async ({ searchParams }: PaginatorProps) => {

<div className="">
<span className="flex justify-between items-center gap-0.5 text-3xl overflow-hidden">
{/* {job.minSalary && <Icon icon="currency" size={35} />} */}
{job.minSalary && job.maxSalary
? `$${formatSalary(job.maxSalary)}`
: 'NotDisclosed'}
Expand All @@ -99,7 +108,7 @@ const JobCard = async ({ searchParams }: PaginatorProps) => {
);
})}
<Pagination>
<PaginationContent>
<PaginationContent className="flex justify-center items-center w-[80%]">
{totalPages ? (
<PaginationItem>
<PaginationPreviousButton
Expand Down
Loading

0 comments on commit 3c76bef

Please sign in to comment.