Web:Common:Fix loaders settings.

This commit is contained in:
Vlada Gazizova 2022-04-20 12:45:36 +03:00
parent 3d8e1b9c65
commit 68ac6c251b

View File

@ -1,5 +1,6 @@
import React, { useEffect } from "react";
import PropTypes from "prop-types";
import { useLocation } from "react-router";
import Loaders from "@appserver/common/components/Loaders";
import { isTablet as isTabletUtils } from "@appserver/components/utils/device";
import { isTablet } from "react-device-detect";
@ -21,15 +22,21 @@ const ArticleHeader = ({
setIsLoadedArticleHeader,
...rest
}) => {
const location = useLocation();
const isLoadedSetting = isLoaded;
const commonSettings = location.pathname.includes("common");
const commonSettings =
location.pathname.includes("common") || location.pathname === "/settings";
useEffect(() => {
if (isLoadedSetting) setIsLoadedArticleHeader(isLoadedSetting);
}, [isLoadedSetting]);
const heightLoader = isTabletUtils() || isTablet ? "20px" : "32px";
const showLoader = commonSettings ? !isLoadedPage : false;
return showLoader ? (
<StyledArticleHeader>
<Loaders.ArticleHeader height={heightLoader} className="loader" />