Created
May 17, 2022 20:16
-
-
Save mrpotatoes/80f36c7168e7a5154e120b8024d327d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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