@@ -1,5 +1,5 @@
|
|||||||
import { useTranslate } from "@probo/i18n";
|
import { useTranslate } from "@probo/i18n";
|
||||||
import { useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import { Badge, Input, IconCrossLargeX } from "@probo/ui";
|
import { Badge, Input, IconCrossLargeX } from "@probo/ui";
|
||||||
import { type Control, Controller, type FieldPath, type FieldValues } from "react-hook-form";
|
import { type Control, Controller, type FieldPath, type FieldValues } from "react-hook-form";
|
||||||
import { getCountryName, getCountryOptions, countries, type CountryCode } from "@probo/helpers";
|
import { getCountryName, getCountryOptions, countries, type CountryCode } from "@probo/helpers";
|
||||||
@@ -98,6 +98,13 @@ function CountryInput({ availableCountries, onAdd }: CountryInputProps) {
|
|||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
const countryOptions = getCountryOptions(__);
|
const countryOptions = getCountryOptions(__);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
document.body.style.overflow = isOpen ? "hidden" : "";
|
||||||
|
return () => {
|
||||||
|
document.body.style.overflow = "";
|
||||||
|
};
|
||||||
|
}, [isOpen]);
|
||||||
|
|
||||||
const filteredCountries = countryOptions
|
const filteredCountries = countryOptions
|
||||||
.filter((option: { value: string; label: string }) => availableCountries.includes(option.value as CountryCode))
|
.filter((option: { value: string; label: string }) => availableCountries.includes(option.value as CountryCode))
|
||||||
.filter((option: { value: string; label: string }) =>
|
.filter((option: { value: string; label: string }) =>
|
||||||
|
|||||||
Reference in New Issue
Block a user