update src/views/Home/Navbar/Laptop/index.js, src/views/Home/Navbar/Laptop/index.scss, src/views/Home/Navbar/Mobile/index.js and src/views/Home/Navbar/Mobile/index.scss fa

front
amir hosein gorji 3 years ago
parent 2253102e3e
commit 1dbb1de3cf
  1. 2
      src/views/Home/Navbar/Laptop/index.js
  2. 42
      src/views/Home/Navbar/Mobile/index.js
  3. 11
      src/views/Home/Navbar/Mobile/index.scss

@ -147,8 +147,6 @@ class LaptopNavbar extends Component {
window.location.reload(); window.location.reload();
}} }}
> >
{console.log(window.lang)}
{[ {[
{ key: "فارسی", lang: "fa", default: true }, { key: "فارسی", lang: "fa", default: true },
{ key: "English", lang: "en" }, { key: "English", lang: "en" },

@ -102,11 +102,25 @@ export default function MobileNavbar(props) {
<div className="mobile-navbar__left d-flex" style={{ marginLeft: 10 }}> <div className="mobile-navbar__left d-flex" style={{ marginLeft: 10 }}>
<select <select
className="language-select" className="language-select"
onChange={(e) => changeLanguage(e.target.value)} onChange={(e) => {
defaultValue={localStorage.getItem("language") || "fa"} window.localStorage.setItem("language", e.target.value);
window.location.reload();
}}
> >
{["fa", "en", "ar"].map((lang, index) => ( {[
<option key={index}>{lang}</option> { key: "فارسی", lang: "fa", default: true },
{ key: "English", lang: "en" },
{ key: "العربیه", lang: "ar" },
].map((el, index) => (
<option
key={el.lang}
value={el.lang}
selected={
(!window.lang && el.default) || el.lang == window.lang
}
>
{el.key}
</option>
))} ))}
</select> </select>
<Link <Link
@ -151,11 +165,23 @@ export default function MobileNavbar(props) {
<div className="mobile-navbar__left"> <div className="mobile-navbar__left">
<select <select
className="language-select" className="language-select"
onChange={(e) => changeLanguage(e.target.value)} onChange={(e) => {
defaultValue={localStorage.getItem("language") || "fa"} window.localStorage.setItem("language", e.target.value);
window.location.reload();
}}
> >
{["fa", "en", "ar"].map((lang, index) => ( {[
<option key={index}>{lang}</option> { key: "فارسی", lang: "fa", default: true },
{ key: "English", lang: "en" },
{ key: "العربیه", lang: "ar" },
].map((el, index) => (
<option
key={el.lang}
value={el.lang}
selected={(!window.lang && el.default) || el.lang == window.lang}
>
{el.key}
</option>
))} ))}
</select> </select>
{page === "home" || page === "download" ? ( {page === "home" || page === "download" ? (

@ -12,15 +12,16 @@
box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.3); box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.3);
.language-select { .language-select {
border: none; border: 1px solid #6cbe44;
outline: none; outline: none;
width: 45px; width: 100px;
background-color: #6cbe44;
color: white; color: #6cbe44;
font-weight: 500; font-weight: 500;
margin: 0px 10px; margin: 0px 10px;
border-radius: 5px; border-radius: 5px;
padding: 0px 4px; padding: 3px;
} }
&__signup { &__signup {

Loading…
Cancel
Save