From a03690080da2c7b76b2c24c09c0a41868fc3e0f0 Mon Sep 17 00:00:00 2001 From: Yangshun Date: Tue, 15 Feb 2022 21:04:32 +0800 Subject: [PATCH] website: differentiate sidebar positions --- website/src/components/SidebarAd/index.js | 59 ++++++++++++++++------- website/src/theme/DocItem/index.js | 2 +- website/src/theme/DocSidebar/index.js | 2 +- website/src/theme/TOC/index.js | 2 +- 4 files changed, 44 insertions(+), 21 deletions(-) diff --git a/website/src/components/SidebarAd/index.js b/website/src/components/SidebarAd/index.js index 3c3f1f24..461901c8 100644 --- a/website/src/components/SidebarAd/index.js +++ b/website/src/components/SidebarAd/index.js @@ -13,7 +13,7 @@ const BACKGROUNDS = [ styles.backgroundRed, ]; -function TopResume({className}) { +function TopResume({className, position}) { return ( { - window.gtag('event', 'topresume.sidebar.click'); + window.gtag('event', `topresume.${position}.click`); }}>

Best resume service for FAANG @@ -34,7 +34,7 @@ function TopResume({className}) { ); } -function AlgoMonster({className}) { +function AlgoMonster({className, position}) { return ( { - window.gtag('event', 'algomonster.sidebar.click'); + window.gtag('event', `algomonster.${position}.click`); }}>

Stop grinding and study with a plan! @@ -54,7 +54,7 @@ function AlgoMonster({className}) { ); } -function Moonchaser({className}) { +function Moonchaser({className, position}) { return ( { - window.gtag('event', 'moonchaser.sidebar.click'); + window.gtag('event', `moonchaser.${position}.click`); }}>

Get paid more. Receive risk-free salary negotiation @@ -74,7 +74,7 @@ function Moonchaser({className}) { ); } -function Educative({className}) { +function Educative({className, position}) { return ( { - window.gtag('event', 'educative.sidebar.click'); + window.gtag('event', `educative.${position}.click`); }}>

Looking to get hired at FAANG? @@ -95,7 +95,7 @@ function Educative({className}) { ); } -function EducativeCoding({className}) { +function EducativeCoding({className, position}) { return ( { - window.gtag('event', 'educative.coding.sidebar.click'); + window.gtag('event', `educative.coding.${position}.click`); }}>

Get the job at FAANG @@ -117,7 +117,7 @@ function EducativeCoding({className}) { ); } -function EducativeSystemDesign({className}) { +function EducativeSystemDesign({className, position}) { return ( { - window.gtag('event', 'educative.coding.sidebar.click'); + window.gtag('event', `educative.system_design.${position}.click`); }}>

Get the job at FAANG @@ -139,7 +139,7 @@ function EducativeSystemDesign({className}) { ); } -export default React.memo(function SidebarAd() { +export default React.memo(function SidebarAd({position}) { const backgroundClass = BACKGROUNDS[Math.floor(Math.random() * BACKGROUNDS.length)]; @@ -152,7 +152,13 @@ export default React.memo(function SidebarAd() { // Ugly hack to show conditional sidebar content. if (path.includes('negotiation') || path.includes('compensation')) { - return ; + return ( + + ); } if ( @@ -164,9 +170,17 @@ export default React.memo(function SidebarAd() { path.includes('algorithms') ) { return Math.random() > 0.5 ? ( - + ) : ( - + ); } @@ -175,14 +189,23 @@ export default React.memo(function SidebarAd() { ); } return Math.random() > 0.5 ? ( - + ) : ( - + ); }} diff --git a/website/src/theme/DocItem/index.js b/website/src/theme/DocItem/index.js index fae45525..d0f7e619 100644 --- a/website/src/theme/DocItem/index.js +++ b/website/src/theme/DocItem/index.js @@ -86,7 +86,7 @@ export default function DocItem(props) {

- +
diff --git a/website/src/theme/DocSidebar/index.js b/website/src/theme/DocSidebar/index.js index 5c91281e..2c36d465 100644 --- a/website/src/theme/DocSidebar/index.js +++ b/website/src/theme/DocSidebar/index.js @@ -89,7 +89,7 @@ const DocSidebarMobileSecondaryMenu = ({toggleSidebar, sidebar, path}) => { level={1} />
- +
); diff --git a/website/src/theme/TOC/index.js b/website/src/theme/TOC/index.js index 0ad56055..111f86e0 100644 --- a/website/src/theme/TOC/index.js +++ b/website/src/theme/TOC/index.js @@ -12,7 +12,7 @@ function TOC({className, ...props}) { return (
- +