diff --git a/src/features/settings/components/language/LanguageComponent.js b/src/features/settings/components/language/LanguageComponent.js
index 9611e6c..7c04970 100644
--- a/src/features/settings/components/language/LanguageComponent.js
+++ b/src/features/settings/components/language/LanguageComponent.js
@@ -1,8 +1,8 @@
import React from "react";
import PropTypes from "prop-types";
import Flag from "react-flags";
-import { IconButton } from "@material-ui/core";
-import LanguageMenu from "./LanguageMenu";
+import { IconButton, Menu, MenuItem } from "@material-ui/core";
+import { useTranslation } from "react-i18next";
const LanguageComponent = ({
languageIsSet,
@@ -11,8 +11,11 @@ const LanguageComponent = ({
onLanguageChange,
onClose,
flag,
- getFlagsPath
+ flagsPath
}) => {
+ const { t } = useTranslation();
+ const open = Boolean(anchorEl);
+
return (
<>
)}
-
+ >
+
+
+
>
);
};
@@ -48,7 +68,7 @@ LanguageComponent.propTypes = {
onLanguageChange: PropTypes.func.isRequired,
onClose: PropTypes.func.isRequired,
flag: PropTypes.object.isRequired,
- getFlagsPath: PropTypes.func.isRequired
+ flagsPath: PropTypes.string.isRequired
};
export default LanguageComponent;
diff --git a/src/features/settings/components/language/LanguageContainer.js b/src/features/settings/components/language/LanguageContainer.js
index 56dab21..0fd9b42 100644
--- a/src/features/settings/components/language/LanguageContainer.js
+++ b/src/features/settings/components/language/LanguageContainer.js
@@ -2,6 +2,10 @@ import React, { useState, useEffect } from "react";
import { useTranslation } from "react-i18next";
import LanguageComponent from "./LanguageComponent";
+const flagsPath = process.env.PUBLIC_URL
+ ? `${process.env.PUBLIC_URL}/flags`
+ : "flags";
+
const LanguageContainer = () => {
const [anchorEl, setAnchorEl] = useState(null);
@@ -34,15 +38,6 @@ const LanguageContainer = () => {
setAnchorEl(null);
};
- const getFlagsPath = () => {
- const basePath = "flags";
- if (process.env.PUBLIC_URL) {
- return `${process.env.PUBLIC_URL}/${basePath}`;
- } else {
- return basePath;
- }
- };
-
return (
{
onLanguageChange={handleLanguageChange}
onClose={handleClose}
flag={flag}
- getFlagsPath={getFlagsPath}
+ flagsPath={flagsPath}
/>
);
};
diff --git a/src/features/settings/components/language/LanguageMenu.js b/src/features/settings/components/language/LanguageMenu.js
deleted file mode 100644
index 4dbea52..0000000
--- a/src/features/settings/components/language/LanguageMenu.js
+++ /dev/null
@@ -1,42 +0,0 @@
-import React from "react";
-import PropTypes from "prop-types";
-import { useTranslation } from "react-i18next";
-import { Menu, MenuItem } from "@material-ui/core";
-
-const LanguageMenu = ({ anchorEl, onLanguageChange, onClose }) => {
- const { t } = useTranslation();
- const open = Boolean(anchorEl);
-
- return (
-
- );
-};
-
-LanguageMenu.propTypes = {
- anchorEl: PropTypes.object,
- onLanguageChange: PropTypes.func.isRequired,
- onClose: PropTypes.func.isRequired
-};
-
-export default LanguageMenu;