From 4c6c4cf2daa28f332b977da871360f912906d66f Mon Sep 17 00:00:00 2001 From: Jakub K Date: Fri, 15 Dec 2023 23:54:10 +0100 Subject: [PATCH] komponenty --- index.html | 4 +- package-lock.json | 6 + package.json | 1 + src/App.jsx | 22 +-- src/assets/index.js | 4 +- src/assets/placeholderImage.svg | 23 ++++ src/components/AddJobListing.jsx | 87 ++++++++++++ src/components/ImageUpload.jsx | 62 +++++++++ src/components/NavBar.jsx | 6 +- src/components/Salary.jsx | 127 ++++++++++++++++++ src/components/SelectedSkill.jsx | 66 +++++++++ src/components/SkillsSelector.jsx | 143 ++++++++++++++++++++ src/components/StepFourJoblisting.jsx | 120 +++++++++++++++++ src/components/StepOneJoblisting.jsx | 68 ++++++++++ src/components/StepThreeJoblisting.jsx | 88 ++++++++++++ src/components/StepTwoJoblisting.jsx | 178 +++++++++++++++++++++++++ src/components/TextDivider.jsx | 16 +++ src/consts/index.js | 2 +- src/icon/android-chrome-192x192.png | Bin 0 -> 11534 bytes src/icon/android-chrome-512x512.png | Bin 0 -> 54224 bytes src/icon/apple-touch-icon.png | Bin 0 -> 10483 bytes src/icon/favicon-16x16.png | Bin 0 -> 502 bytes src/icon/favicon-32x32.png | Bin 0 -> 1155 bytes src/icon/favicon.ico | Bin 0 -> 15406 bytes src/icon/site.webmanifest | 1 + src/index.css | 30 ++++- src/style.js | 1 + 27 files changed, 1034 insertions(+), 21 deletions(-) create mode 100644 src/assets/placeholderImage.svg create mode 100644 src/components/AddJobListing.jsx create mode 100644 src/components/ImageUpload.jsx create mode 100644 src/components/Salary.jsx create mode 100644 src/components/SelectedSkill.jsx create mode 100644 src/components/SkillsSelector.jsx create mode 100644 src/components/StepFourJoblisting.jsx create mode 100644 src/components/StepOneJoblisting.jsx create mode 100644 src/components/StepThreeJoblisting.jsx create mode 100644 src/components/StepTwoJoblisting.jsx create mode 100644 src/components/TextDivider.jsx create mode 100644 src/icon/android-chrome-192x192.png create mode 100644 src/icon/android-chrome-512x512.png create mode 100644 src/icon/apple-touch-icon.png create mode 100644 src/icon/favicon-16x16.png create mode 100644 src/icon/favicon-32x32.png create mode 100644 src/icon/favicon.ico create mode 100644 src/icon/site.webmanifest diff --git a/index.html b/index.html index 4b26856..b7a44d1 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,9 @@ - + + + izaac frontend diff --git a/package-lock.json b/package-lock.json index c6c7353..3cfc64a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "@ckeditor/ckeditor5-build-classic": "^40.0.0", "@ckeditor/ckeditor5-build-multi-root": "^40.0.0", "@ckeditor/ckeditor5-react": "^6.1.0", + "dompurify": "^3.0.6", "react": "^18.2.0", "react-dom": "^18.2.0", "react-router-dom": "^6.18.0" @@ -2069,6 +2070,11 @@ "node": ">=6.0.0" } }, + "node_modules/dompurify": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.0.6.tgz", + "integrity": "sha512-ilkD8YEnnGh1zJ240uJsW7AzE+2qpbOUYjacomn3AvJ6J4JhKGSZ2nh4wUIXPZrEPppaCLx5jFe8T89Rk8tQ7w==" + }, "node_modules/electron-to-chromium": { "version": "1.4.574", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.574.tgz", diff --git a/package.json b/package.json index eaa2b9b..85b1800 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "@ckeditor/ckeditor5-build-classic": "^40.0.0", "@ckeditor/ckeditor5-build-multi-root": "^40.0.0", "@ckeditor/ckeditor5-react": "^6.1.0", + "dompurify": "^3.0.6", "react": "^18.2.0", "react-dom": "^18.2.0", "react-router-dom": "^6.18.0" diff --git a/src/App.jsx b/src/App.jsx index 3a91057..c98fc84 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -5,29 +5,35 @@ import Home from './components/Home'; import { BrowserRouter as Router } from 'react-router-dom'; import { Route, Routes } from 'react-router-dom'; import Contact from './components/Contact'; -import JobPosting from './components/JobPosting'; import Mininav from './components/Mininav'; -import Register from './components/Register'; +import AddJobListing from './components/AddJobListing'; function App() { + const loc = () =>{ + if (location.pathname.startsWith('work/jobposting')){ + return "" + } else { + return "overflow-hidden" + } +} return ( -
-
- +
+
+
-
+
} /> } /> - } /> + } /> } /> - } /> + } /> {/* Add more routes as needed */}
diff --git a/src/assets/index.js b/src/assets/index.js index d74f9af..cb9d1b1 100644 --- a/src/assets/index.js +++ b/src/assets/index.js @@ -2,9 +2,11 @@ import close from './close.svg' import menu from './menu.svg' import search from './search.svg' import IzaacLOGO from './IzaacLOGO.svg' +import placeholderImage from './placeholderImage.svg' export { close, menu, search, - IzaacLOGO + IzaacLOGO, + placeholderImage } \ No newline at end of file diff --git a/src/assets/placeholderImage.svg b/src/assets/placeholderImage.svg new file mode 100644 index 0000000..d18a6b2 --- /dev/null +++ b/src/assets/placeholderImage.svg @@ -0,0 +1,23 @@ + + + + +Created by potrace 1.16, written by Peter Selinger 2001-2019 + + + + + + + diff --git a/src/components/AddJobListing.jsx b/src/components/AddJobListing.jsx new file mode 100644 index 0000000..61275a4 --- /dev/null +++ b/src/components/AddJobListing.jsx @@ -0,0 +1,87 @@ +import React, { useState, useEffect } from 'react' +import StepOneJoblisting from './StepOneJoblisting'; +import StepTwoJoblisting from './StepTwoJoblisting'; +import StepThreeJoblisting from './StepThreeJoblisting'; +import StepFourJoblisting from './StepFourJoblisting' +const AddJobListing = () => { + const [currentStep, setCurrentStep] = useState(1) + const [formData, setFormData] = useState({ + 'postingOption': 'Opcja 2', + 'requireSalary': true + }) + const nextStep = () => { + setCurrentStep(currentStep + 1); + }; + + const prevStep = () => { + setCurrentStep(currentStep - 1); + }; + const removeFields = (fieldNames) => { + // Utwórz nowy obiekt, który początkowo jest kopią formData + let newFormData = { ...formData }; + + // Iteruj przez każde pole do usunięcia + fieldNames.forEach(fieldName => { + // Usuń pole z nowego obiektu danych + delete newFormData[fieldName]; + }); + + // Aktualizuj stan z nowym obiektem + setFormData(newFormData); +}; + + const handleChange = input => value => { + // Sprawdzenie, czy 'value' jest obiektem zdarzenia + const isEvent = value && value.target; + let newValue; + + if (isEvent) { + // Jeśli 'value' jest obiektem zdarzenia, użyj jego właściwości 'value' + newValue = value.target.value; + } else { + // W przeciwnym razie użyj 'value' bezpośrednio + newValue = value; + } + + setFormData({ ...formData, [input]: newValue }); + console.log('Aktualny stan formularza:', formData); +}; + + const handleSubmit = () => { + + } + useEffect(() => { + console.log('Aktualny stan formularza:', formData); + }, [formData]); + + switch (currentStep) { + case 1: + return ; + case 2: + return ; + case 3: + return ; + case 4: + return ; + default: + return
Unknown step
; + } +}; + + +export default AddJobListing; diff --git a/src/components/ImageUpload.jsx b/src/components/ImageUpload.jsx new file mode 100644 index 0000000..d14ae87 --- /dev/null +++ b/src/components/ImageUpload.jsx @@ -0,0 +1,62 @@ +import React, { useState, useRef, useEffect } from 'react'; +import { IzaacLOGO, placeholderImage } from '../assets' + +const ImageUpload = ({setFormData}) => { + const [imageSrc, setImageSrc] = useState(placeholderImage); + const fileInputRef = useRef(); // Referencja do ukrytego inputu plików + + const handleImageChange = (e) => { + const file = e.target.files[0]; + if (file) { + const reader = new FileReader(); + reader.onload = (e) => { + setImageSrc(e.target.result); // Aktualizujemy stan obrazkiem użytkownika + }; + reader.readAsDataURL(file); + } + }; + + const handleDivClick = () => { + fileInputRef.current.click(); // Programowe kliknięcie na ukrytym inpucie plików + }; + + useEffect(() => { + // Aktualizujemy dane w hooku nadrzędnym za każdym razem, gdy zmienia się imageSrc + if (imageSrc !== placeholderImage) { + setFormData(prevFormData => ({ + ...prevFormData, + image: imageSrc + })); + } + }, [imageSrc, setFormData]); + + + return ( + <> +
+ +
+ + + ); +}; + +export default ImageUpload; diff --git a/src/components/NavBar.jsx b/src/components/NavBar.jsx index ad232da..1155468 100644 --- a/src/components/NavBar.jsx +++ b/src/components/NavBar.jsx @@ -4,7 +4,7 @@ import { close, search, menu, IzaacLOGO} from '../assets'; import { useState } from 'react'; import { useLocation } from 'react-router-dom'; import { Link } from 'react-router-dom'; - +import Mininav from './Mininav'; const NavBar = () => { const[toggle, setToggle] = useState(false) const[toggleSearch, setToggleSearch] = useState(false) @@ -20,8 +20,8 @@ const NavBar = () => { const currentLinks = getLinks() return ( -