From 93dfe2be64e8658839bcfe5356adf35f8cde7075 Mon Sep 17 00:00:00 2001 From: Nicolas James Date: Thu, 13 Feb 2025 18:04:18 +1100 Subject: initial commit --- src/web/helpers/Location.jsx | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/web/helpers/Location.jsx (limited to 'src/web/helpers/Location.jsx') diff --git a/src/web/helpers/Location.jsx b/src/web/helpers/Location.jsx new file mode 100644 index 0000000..cae0b9e --- /dev/null +++ b/src/web/helpers/Location.jsx @@ -0,0 +1,29 @@ +import {faHouse, + faBolt, + faCode, + faCamera, + faCar, + faWrench, + faGamepad, + faQuestion} from "@fortawesome/free-solid-svg-icons"; + + +export function getSubreactFromLocation(location) { + const paths = location.pathname.split("/"); + return paths.length >= 1 ? paths[1] : ""; +} + +export function getInfoFromSubreact(subreact) { + switch (subreact) { + case "": return {icon: faHouse, name: "home"} + case "t": return {icon: faBolt, name: "technology"} + case "g": return {icon: faGamepad, name: "gaming"} + case "k": return {icon: faCode, name: "programming"} + case "p": return {icon: faCamera, name: "photography"} + case "a": return {icon: faCar, name: "automobiles"} + case "pr": return {icon: faWrench, name: "projects"} + case "m": return {icon: faQuestion, name: "miscellaneous"} + default: break; + } + return {}; +} \ No newline at end of file -- cgit v1.2.3