Skip to content

Instantly share code, notes, and snippets.

@mrpotatoes
Created May 17, 2022 20:16
Show Gist options
  • Save mrpotatoes/80f36c7168e7a5154e120b8024d327d9 to your computer and use it in GitHub Desktop.
Save mrpotatoes/80f36c7168e7a5154e120b8024d327d9 to your computer and use it in GitHub Desktop.
/* eslint-disable no-prototype-builtins */
import Overrides from './overrides';
import Themed from './theme';
import Main from './default';
const handler = {
get: (target: any, name: string): any => (target.hasOwnProperty(name) ? target[name] : Main),
};
const mapping = {
overrides: Overrides,
theme: Themed,
};
export const Mapper = new Proxy(mapping, handler);
export const ChosenPage = () => {
const path = window.location.pathname;
return Mapper[path.replace('/', '')];
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment