add translate
This commit is contained in:
parent
2ffce71e74
commit
5667f30a92
@ -123,6 +123,15 @@
|
|||||||
"title": "Результаты поиска",
|
"title": "Результаты поиска",
|
||||||
"totalResults":"Всего найдено",
|
"totalResults":"Всего найдено",
|
||||||
"nothingFound": "Ничего не найдено"
|
"nothingFound": "Ничего не найдено"
|
||||||
|
},
|
||||||
|
"filters": {
|
||||||
|
"authors":"Авторы",
|
||||||
|
"publicationsType": "Публикации",
|
||||||
|
"publisher":"Издатель",
|
||||||
|
"publicationTopic":"Тема публикации",
|
||||||
|
"appliedFitlers":"Фильтры",
|
||||||
|
"clearAll":"Очистить всё",
|
||||||
|
"enterAuthorsName":"Введите имя автора",
|
||||||
|
"showAll":"Показать все"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ import React from "react";
|
|||||||
import Badge from "components/Badge";
|
import Badge from "components/Badge";
|
||||||
import { IProduct } from "./IProdutct";
|
import { IProduct } from "./IProdutct";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* Component props */
|
/* Component props */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
@ -23,6 +25,9 @@ export default function AppiledFilters({
|
|||||||
clearAll,
|
clearAll,
|
||||||
className,
|
className,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
|
|
||||||
|
const [t, i18next] = useTranslation()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div
|
<div
|
||||||
@ -32,13 +37,13 @@ export default function AppiledFilters({
|
|||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div className="flex flex-row items-center justify-between space-x-3 ">
|
<div className="flex flex-row items-center justify-between space-x-3 ">
|
||||||
<div className="font-medium">Фильтры</div>
|
<div className="font-medium">{t("filters.appliedFitlers")}</div>
|
||||||
<div>
|
<div>
|
||||||
<button
|
<button
|
||||||
onClick={clearAll}
|
onClick={clearAll}
|
||||||
className="font-normal text-sm text-gray-400"
|
className="font-normal text-sm text-gray-400"
|
||||||
>
|
>
|
||||||
Очистить всё
|
{t("filters.clearAll")}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -5,6 +5,8 @@ import SearchFilterBar from "./SearchFilterBar";
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { useDebounce } from "./functions/debounce";
|
import { useDebounce } from "./functions/debounce";
|
||||||
import { IProduct } from "./IProdutct";
|
import { IProduct } from "./IProdutct";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
className?: string;
|
className?: string;
|
||||||
@ -26,6 +28,9 @@ export default function Fiter({ className }: Props) {
|
|||||||
};
|
};
|
||||||
const debounced = useDebounce(query);
|
const debounced = useDebounce(query);
|
||||||
|
|
||||||
|
const [t, i18next] = useTranslation()
|
||||||
|
|
||||||
|
|
||||||
async function fetchProducts() {
|
async function fetchProducts() {
|
||||||
const response = await axios.get(
|
const response = await axios.get(
|
||||||
`https://dummyjson.com/products/search?q=${debounced}`
|
`https://dummyjson.com/products/search?q=${debounced}`
|
||||||
@ -83,23 +88,23 @@ export default function Fiter({ className }: Props) {
|
|||||||
delFilter={DelFilter}
|
delFilter={DelFilter}
|
||||||
clearAll={clearAll}
|
clearAll={clearAll}
|
||||||
></AppiledFilters>
|
></AppiledFilters>
|
||||||
<Disclosure caption="Авторы">
|
<Disclosure caption={t("filters.authors")}>
|
||||||
<SearchFilterBar
|
<SearchFilterBar
|
||||||
hints={hints}
|
hints={hints}
|
||||||
isChecked={isChecked}
|
isChecked={isChecked}
|
||||||
handleChange={handleChange}
|
handleChange={handleChange}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
query={query}
|
query={query}
|
||||||
placeHolder={"Введите имя автора"}
|
placeHolder={t("filters.enterAuthorsName")}
|
||||||
/>
|
/>
|
||||||
</Disclosure>
|
</Disclosure>
|
||||||
<Disclosure caption="Публикации">
|
<Disclosure caption={t("filters.publicationsType")}>
|
||||||
<p>контент...</p>
|
<p>контент...</p>
|
||||||
</Disclosure>
|
</Disclosure>
|
||||||
<Disclosure caption="Тип издания">
|
<Disclosure caption={t("filters.publisher")}>
|
||||||
<p>контент...</p>
|
<p>контент...</p>
|
||||||
</Disclosure>
|
</Disclosure>
|
||||||
<Disclosure caption="Тематика публикаций">
|
<Disclosure caption={t("filters.publicationTopic")}>
|
||||||
<p>контент...</p>
|
<p>контент...</p>
|
||||||
</Disclosure>
|
</Disclosure>
|
||||||
</div>
|
</div>
|
||||||
|
@ -4,6 +4,8 @@ import { IProduct } from "./IProdutct";
|
|||||||
import Checkbox from "components/Checkbox";
|
import Checkbox from "components/Checkbox";
|
||||||
import { ReactComponent as SearchIcon } from "assets/svg/search.svg";
|
import { ReactComponent as SearchIcon } from "assets/svg/search.svg";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
hints: IProduct[];
|
hints: IProduct[];
|
||||||
@ -26,6 +28,7 @@ export default function SearchFilterBar({
|
|||||||
}: Props): JSX.Element {
|
}: Props): JSX.Element {
|
||||||
const [checkList, setCheckList] = useState(hints);
|
const [checkList, setCheckList] = useState(hints);
|
||||||
const [showFilters, SetShowFilters] = useState(false);
|
const [showFilters, SetShowFilters] = useState(false);
|
||||||
|
const [t, i18next] = useTranslation()
|
||||||
|
|
||||||
const ShowAllFilters = useCallback(() => {
|
const ShowAllFilters = useCallback(() => {
|
||||||
SetShowFilters((prev) => !prev);
|
SetShowFilters((prev) => !prev);
|
||||||
@ -84,7 +87,7 @@ export default function SearchFilterBar({
|
|||||||
onClick={ShowAllFilters}
|
onClick={ShowAllFilters}
|
||||||
className="text-right text-blue-500 pl-2 text-sm font-medium"
|
className="text-right text-blue-500 pl-2 text-sm font-medium"
|
||||||
>
|
>
|
||||||
Показать всё({hints.length})
|
{t("filters.showAll")}({hints.length})
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</li>
|
</li>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user