Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions public/assets/images/planetDarkLogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion src/features/common/InputTypes/ToggleSwitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export default function ToggleSwitch(props: any) {
},
},
checked: {},
track: {},
track: {
backgroundColor: '#787878',
},
})(Switch);
return (
<ToggleSwitch
Expand Down
52 changes: 33 additions & 19 deletions src/features/common/Layout/Navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import getImageUrl from '../../../../utils/getImageURL';
import { UserPropsContext } from '../UserPropsContext';
import GetNavBarIcon from './getNavBarIcon';
import GetSubMenu from './getSubMenu';
import { lang_path } from '../../../../utils/constants/wpLanguages'
import { lang_path } from '../../../../utils/constants/wpLanguages';

// used to detect window resize and return the current width of the window
const useWidth = () => {
const [width, setWidth] = React.useState(0); // default width, detect on server.
Expand All @@ -35,8 +36,8 @@ export default function NavbarComponent(props: any) {
yucatan: 'yucatan',
partners: 'partners',
changeChocolate: 'change-chocolate',
stopTalkingStartPlanting: 'stop-talking-start-planting'
}
stopTalkingStartPlanting: 'stop-talking-start-planting',
};
const [menu, setMenu] = React.useState(false);
const [isMobile, setIsMobile] = React.useState(false);
const [mobileWidth, setMobileWidth] = React.useState(false);
Expand Down Expand Up @@ -75,7 +76,7 @@ export default function NavbarComponent(props: any) {
}
}

const { toggleTheme } = React.useContext(ThemeContext);
const { toggleTheme, theme } = React.useContext(ThemeContext);

// if (isLoading) {
// return <div></div>;
Expand Down Expand Up @@ -162,12 +163,13 @@ export default function NavbarComponent(props: any) {
);
}
if (link === 'about' && SingleLink.visible) {
let aboutOnclick = `${SingleLink.onclick}${(process.env.TENANT === 'planet' ||
let aboutOnclick = `${SingleLink.onclick}${
(process.env.TENANT === 'planet' ||
process.env.TENANT === 'ttc') &&
lang_path[i18n.language]
lang_path[i18n.language]
? lang_path[i18n.language]
: ''
}`;
}`;

aboutOnclick = isMobile ? '' : aboutOnclick;
SingleLink = {
Expand All @@ -179,7 +181,7 @@ export default function NavbarComponent(props: any) {
}
}
if (link === 'shop' && mobileWidth) {
SingleLink.visible = false
SingleLink.visible = false;
}
return SingleLink.visible ? (
<div
Expand All @@ -193,9 +195,7 @@ export default function NavbarComponent(props: any) {
}
key={link}
>
<Link
href={isMobile && hasSubMenu ? '' : SingleLink.onclick}
>
<Link href={isMobile && hasSubMenu ? '' : SingleLink.onclick}>
<div className={`linkContainer`}>
<GetNavBarIcon
UserIcon={UserIcon}
Expand Down Expand Up @@ -234,7 +234,11 @@ export default function NavbarComponent(props: any) {
<a
key={submenu.title}
className={'menuRow'}
href={`https://a.plant-for-the-planet.org/${lang_path[i18n.language] ? lang_path[i18n.language] : 'en'}/${subMenuPath[submenu.title]}`}
href={`https://a.plant-for-the-planet.org/${
lang_path[i18n.language]
? lang_path[i18n.language]
: 'en'
}/${subMenuPath[submenu.title]}`}
>
<div
style={{
Expand Down Expand Up @@ -297,13 +301,23 @@ export default function NavbarComponent(props: any) {
</div>
)}

<a href="https://a.plant-for-the-planet.org">
<img
className={'tenantLogo'}
src={`${process.env.CDN_URL}/logo/svg/planet.svg`}
alt={t('common:about_pftp')}
/>
</a>
{theme === 'theme-light' ? (
<a href="https://a.plant-for-the-planet.org">
<img
className={'tenantLogo'}
src={`${process.env.CDN_URL}/logo/svg/planet.svg`}
alt={t('common:about_pftp')}
/>
</a>
) : (
<a href="https://a.plant-for-the-planet.org">
<img
className={'tenantLogo'}
src={`/assets/images/PlanetDarkLogo.svg`}
alt={t('common:about_pftp')}
/>
</a>
)}
</div>
{ready && <MenuItems />}
</div>
Expand Down