From 851e631b76b2598a5d7c3e7de5bde42c5e960201 Mon Sep 17 00:00:00 2001 From: Deepanshu Mishra Date: Sat, 31 Aug 2024 15:31:37 +0530 Subject: [PATCH 1/7] init_job_create --- package.json | 1 + src/app/create/page.tsx | 8 +- src/app/globals.css | 48 +++ src/components/JobDescriptionEditor.tsx | 41 +++ src/components/job-form.tsx | 398 +++++++++++++++--------- src/components/ui/card.tsx | 86 +++++ 6 files changed, 428 insertions(+), 154 deletions(-) create mode 100644 src/components/JobDescriptionEditor.tsx create mode 100644 src/components/ui/card.tsx diff --git a/package.json b/package.json index 940ac277..d3fdd7ba 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "react-dom": "^18", "react-hook-form": "^7.52.2", "react-icons": "^5.2.1", + "react-quill": "^2.0.0", "tailwind-merge": "^2.4.0", "tailwindcss-animate": "^1.0.7", "zod": "^3.23.8", diff --git a/src/app/create/page.tsx b/src/app/create/page.tsx index 7b32f80e..92548bd3 100644 --- a/src/app/create/page.tsx +++ b/src/app/create/page.tsx @@ -3,7 +3,13 @@ import React from 'react'; const page = () => { return ( -
+
+
+

Post a job

+

+ 100xJobs is trusted by leading companies +

+
); diff --git a/src/app/globals.css b/src/app/globals.css index 6228a08a..b3c421ed 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -297,3 +297,51 @@ transform: rotate(360deg); } } + +/* Custom styles for Quill editor */ +.ql-toolbar.ql-snow { + border: none !important; + background-color: #1f2937 !important; + border-bottom: 1px solid #374151 !important; +} + +.ql-container.ql-snow { + border: none !important; + max-height: 56rem; /* Set a fixed height */ + overflow-y: hidden; /* Hide vertical overflow */ + overflow-x: auto; /* Allow horizontal scrolling */ +} + +.ql-editor { + min-height: 10px; + overflow-y: hidden; /* Prevent height increase */ + white-space: nowrap; /* Ensure long lines don't wrap */ +} + +.ql-editor.ql-blank::before { + color: #6b7280 !important; +} + +.ql-snow .ql-stroke { + stroke: #9ca3af !important; +} + +.ql-snow .ql-fill { + fill: #9ca3af !important; +} + +.ql-snow .ql-picker { + color: #9ca3af !important; +} + +/* Ensure the editor takes up full width of its container */ +.job-description-editor { + width: 100% !important; +} + +/* Ensure long content does not wrap within the editor */ +.job-description-editor .ql-editor { + white-space: nowrap !important; + overflow-x: hidden !important; /* Allow horizontal scrolling */ + overflow-y: hidden !important; /* Hide vertical overflow */ +} diff --git a/src/components/JobDescriptionEditor.tsx b/src/components/JobDescriptionEditor.tsx new file mode 100644 index 00000000..abe51f67 --- /dev/null +++ b/src/components/JobDescriptionEditor.tsx @@ -0,0 +1,41 @@ +import React from 'react'; +import ReactQuill from 'react-quill'; +import 'react-quill/dist/quill.snow.css'; + +const JobDescriptionEditor = () => { + const modules = { + toolbar: [ + ['bold', 'italic', 'underline'], + [{ header: '1' }, { header: '2' }], + [{ list: 'ordered' }, { list: 'bullet' }], + ['link'], + ], + }; + + const formats = [ + 'bold', + 'italic', + 'underline', + 'header', + 'list', + 'bullet', + 'link', + ]; + + return ( +
+

Job description

+
+ +
+
+ ); +}; + +export default JobDescriptionEditor; diff --git a/src/components/job-form.tsx b/src/components/job-form.tsx index f5e6621d..baf7c3b4 100644 --- a/src/components/job-form.tsx +++ b/src/components/job-form.tsx @@ -3,15 +3,14 @@ import { createJob } from '@/actions/job.action'; import { Form, FormControl, + FormDescription, FormField, FormItem, FormLabel, - FormMessage, } from '@/components/ui/form'; import { Select, SelectContent, - SelectItem, SelectTrigger, SelectValue, } from '@/components/ui/select'; @@ -24,11 +23,12 @@ import { } from '../lib/validators/jobs.validator'; import { Button } from './ui/button'; import { Input } from './ui/input'; -import { Textarea } from './ui/textarea'; -import { Label } from './ui/label'; -import { Switch } from './ui/switch'; import { useToast } from './ui/use-toast'; -import { filters } from '@/lib/constant/jobs.constant'; +import { Calendar, LucideRocket, MailOpenIcon } from 'lucide-react'; +import JobDescriptionEditor from './JobDescriptionEditor'; +import ReactQuill from 'react-quill'; +import Image from 'next/image'; + const PostJobForm = () => { const { toast } = useToast(); const form = useForm({ @@ -43,6 +43,26 @@ const PostJobForm = () => { maxSalary: 0, }, }); + + const modules = { + toolbar: [ + ['bold', 'italic', 'underline'], + [{ header: '1' }, { header: '2' }], + [{ list: 'ordered' }, { list: 'bullet' }], + ['link'], + ], + }; + + const formats = [ + 'bold', + 'italic', + 'underline', + 'header', + 'list', + 'bullet', + 'link', + ]; + const handleFormSubmit = async (data: JobPostSchemaType) => { try { const response = await createJob(data); @@ -77,199 +97,271 @@ const PostJobForm = () => { } }, [watchHasSalaryRange, form]); return ( -
- -
+
+
+
+ +

Posted for

+

30 days

+
+ +
+ +

Emailed to

+

290,301 subscribers

+
+ +
+ +

Reach

+

+ 300,000+ +

+
+
+ + + +

Job details

+ ( - - Job Title - + Job title* - )} /> -
-
- ( - - - Description - - -