import React from 'react';

import { ReactComponent as Logo } from 'interface/images/logo.svg';

// This has an elevator music easter egg that occurs randomly once every 5 times.
// Lazy load it to minimize bundle impact. This whole joke has a tiny amount of overhead.
let elevator;
async function loadElevator() {
  elevator = (await import('./elevate')).default;
}
let useElevator = Math.random() < 0.1;

function scrollToTop() {
  if (!useElevator || !elevator) {
    window.scrollTo(0, 0);
  } else {
    elevator();
    // Only do it once to increase ~~confusion~~ mystery
    useElevator = false;
  }
}

const ScrollToTop = () => (
  <div className="clickable text-right" onClick={scrollToTop} onMouseEnter={useElevator ? loadElevator : undefined}>
    <Logo
      style={{ '--arrow': '#fab700', '--main': '#1c1c1b', maxWidth: 50 }}
    />
  </div>
);

export default ScrollToTop;

import React from 'react';

import { ReactComponent as Logo } from 'interface/images/logo.svg';

// This has an elevator music easter egg that occurs randomly once every 5 times.
// Lazy load it to minimize bundle impact. This whole joke has a tiny amount of overhead.
let elevator;
async function loadElevator() {
  elevator = (await import('./elevate')).default;
}
let useElevator = Math.random() < 0.2;

function scrollToTop() {
  if (!useElevator || !elevator) {
    window.scrollTo(0, 0);
  } else {
    elevator();
    // Only do it once to increase ~~confusion~~ mystery
    useElevator = false;
  }
}

const ScrollToTop = () => (
  <div className="clickable text-right" onClick={scrollToTop} onMouseEnter={useElevator ? loadElevator : undefined}>
    <Logo
      style={{ '--arrow': '#fab700', '--main': '#1c1c1b', maxWidth: 50 }}
    />
  </div>
);

export default ScrollToTop;

--- 
+++ 
@@ -8,7 +8,7 @@
 async function loadElevator() {
   elevator = (await import('./elevate')).default;
 }
-let useElevator = Math.random() < 0.2;
+let useElevator = Math.random() < 0.1;
 
 function scrollToTop() {
   if (!useElevator || !elevator) {
Reduce elevator chance to 1 in 10 again
