From c9f869f09b6950953c1f08c3b1ebb9c0fa59b04e Mon Sep 17 00:00:00 2001 From: Antoine M Date: Tue, 13 Feb 2024 19:26:36 +0100 Subject: [PATCH] reorganising files --- src/components/CountrySelect.jsx | 45 -------------------------------- src/components/Menu.jsx | 19 -------------- src/components/ProfileSelect.jsx | 35 ------------------------- 3 files changed, 99 deletions(-) delete mode 100644 src/components/CountrySelect.jsx delete mode 100644 src/components/Menu.jsx delete mode 100644 src/components/ProfileSelect.jsx diff --git a/src/components/CountrySelect.jsx b/src/components/CountrySelect.jsx deleted file mode 100644 index b3e8867..0000000 --- a/src/components/CountrySelect.jsx +++ /dev/null @@ -1,45 +0,0 @@ -import { useState } from "react"; -import { v4 as uuidv4 } from "uuid"; -import { useWordpressCustomData } from "../hooks/WordpressFetchData.js"; -import { useUserContext } from "../hooks/useUserContext.jsx"; - -export default function CountrySelect() { - const availableCountries = useWordpressCustomData("/available-countries"); - const { country, changeCountry } = useUserContext(); - - const [isSubmenuOpen, setIsSubmenuOpen] = useState(false); - - if (!availableCountries || !country) return
Loading...
; - - function handleChangeCountry(key, value) { - changeCountry({ name: value, iso: key }); - handleShowHideSubmenu(); - } - function handleShowHideSubmenu() { - setIsSubmenuOpen(!isSubmenuOpen); - } - - const countryOptions = Object.keys(availableCountries).map((key, value) => ( -
  • handleChangeCountry(key, availableCountries[key])}> - - {availableCountries[key]} -
  • - )); - - if (!countryOptions) return; - - return ( -
    - - -
    - ); -} diff --git a/src/components/Menu.jsx b/src/components/Menu.jsx deleted file mode 100644 index b6a2d4c..0000000 --- a/src/components/Menu.jsx +++ /dev/null @@ -1,19 +0,0 @@ -import { NavLink } from "react-router-dom"; -import { useLocation } from "react-router-dom"; -import { useUserContext } from "../hooks/useUserContext"; -export default function Menu() { - let location = useLocation(); - const { language, changeLanguage } = useUserContext(); - - return ( - - ); -} diff --git a/src/components/ProfileSelect.jsx b/src/components/ProfileSelect.jsx deleted file mode 100644 index 4fff3d3..0000000 --- a/src/components/ProfileSelect.jsx +++ /dev/null @@ -1,35 +0,0 @@ -import React, { useState } from "react"; -import { v4 as uuidv4 } from "uuid"; -import { useUserContext } from "../hooks/useUserContext"; - -export default function CountrySelect({ options }) { - const [isSubmenuOpen, setIsSubmenuOpen] = useState(false); - const { profile, changeProfile } = useUserContext(); - - function handleShowHideSubmenu() { - setIsSubmenuOpen(!isSubmenuOpen); - } - - function handleChangeProfile() { - changeProfile("subcontractor_employee"); - } - - if (!profile) return
    Loading...
    ; - - const selectOptions = Object.keys(options).map((key) => ( -
  • handleChangeProfile()}> - {options[key]} -
  • - )); - - return ( -
    - - -
    - ); -}