diff --git a/package.json b/package.json
index b50525d..fdba318 100644
--- a/package.json
+++ b/package.json
@@ -27,6 +27,8 @@
"babel-polyfill": "^6.26.0",
"react": "^16.3.2",
"react-dom": "^16.3.2",
+ "react-router": "^4.2.0",
+ "react-router-dom": "^4.2.2",
"react-tap-event-plugin": "^3.0.2"
},
"devDependencies": {
diff --git a/public/App.jsx b/public/App.jsx
index 5875483..45581bd 100644
--- a/public/App.jsx
+++ b/public/App.jsx
@@ -23,6 +23,7 @@
import React from 'react';
import Navbar from './nav/navbar/Navbar';
+import { HashRouter, Route, Switch } from 'react-router-dom';
//Pages
import KitchenSinkPage from './page/test/KitchenSinkPage';
@@ -35,12 +36,16 @@ class App extends React.Component {
render() {
return (
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
);
}
}
diff --git a/public/language/Language.jsx b/public/language/Language.jsx
new file mode 100644
index 0000000..ec831ce
--- /dev/null
+++ b/public/language/Language.jsx
@@ -0,0 +1,75 @@
+// Copyright (c) 2018 Dominic Masters
+//
+// MIT License
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+import enAU from './en-AU.jsx';
+
+const LANGUAGES = {
+ 'en-AU': enAU
+}
+
+class Language {
+ constructor() {
+ this.setLanguage("en-AU");
+ }
+
+ setLanguage(lang) {
+ this.langName = lang;
+ this.data = LANGUAGES[lang];
+ }
+
+ getLanguage() {
+ return this.langName;
+ }
+
+ get(key) {
+ if(typeof key === typeof undefined) return "Key \"undefined\".";
+ let j = this.getRecursive(key.split("."));
+ if(typeof j === typeof undefined || j == null) return "Missing \"" + key + "\"";
+ return j;
+ }
+
+ getRecursive(key_array, data_obj) {
+ if(typeof data_obj === typeof undefined) data_obj = this.data;
+ if(typeof data_obj === typeof undefined) return null;
+
+ let k = key_array[0];
+ let o = data_obj[k];
+ if(typeof o === typeof undefined) return null;
+ if(typeof o === 'function') o = o();
+
+ //Awesome
+ if(key_array.length > 1) {
+ if(typeof o !== "object") return null;
+ key_array.shift();
+ return this.getRecursive(key_array, o);
+ }
+ return o;
+ }
+
+ getLanguages() {
+ return Object.keys(LANGUAGES);
+ }
+}
+
+const lang = new Language();
+export default lang;
diff --git a/public/language/en-AU.jsx b/public/language/en-AU.jsx
new file mode 100644
index 0000000..c989097
--- /dev/null
+++ b/public/language/en-AU.jsx
@@ -0,0 +1,9 @@
+import React from 'react';
+
+module.exports = {
+ "navbar": {
+ "home": "Home",
+ "about": "About",
+ "contact": "Contact"
+ }
+}
diff --git a/public/nav/navbar/Navbar.jsx b/public/nav/navbar/Navbar.jsx
index a8912b6..b484fb6 100644
--- a/public/nav/navbar/Navbar.jsx
+++ b/public/nav/navbar/Navbar.jsx
@@ -22,6 +22,14 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import React from 'react';
+import { NavLink } from 'react-router-dom'
+import Language from './../../language/Language';
+
+const NAVBAR_LINKS = {
+ "home": "/",
+ "about": "/about",
+ "contact": "/contact"
+};
class Navbar extends React.Component {
constructor(props) {
@@ -29,6 +37,17 @@ class Navbar extends React.Component {
}
render() {
+ let links = [];
+ let keys = Object.keys(NAVBAR_LINKS);
+ for(let i = 0; i < keys.length; i++) {
+ let k = keys[i];
+ links.push(
+
+ { Language.get("navbar." + k) }
+
+ );
+ }
+
return (
);
diff --git a/public/page/test/KitchenSinkPage.jsx b/public/page/test/KitchenSinkPage.jsx
index 52d3a39..f1fe758 100644
--- a/public/page/test/KitchenSinkPage.jsx
+++ b/public/page/test/KitchenSinkPage.jsx
@@ -43,7 +43,7 @@ class KitchenSinkPage extends React.Component {
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.
-
+
Most Downloaded Movies on BitTorrent, 2011
@@ -57,7 +57,7 @@ class KitchenSinkPage extends React.Component {
- torrentfreak.com |
+ torrentfreak.com |
diff --git a/public/styles/objects/_navbar.scss b/public/styles/objects/_navbar.scss
index 1c7d37f..573d469 100644
--- a/public/styles/objects/_navbar.scss
+++ b/public/styles/objects/_navbar.scss
@@ -11,6 +11,8 @@
* Version:
* 1.0.0 - 2018/05/03
*/
+$o-navbar--link-thickness: 5px;
+
.o-navbar {
@extend %t-flexbox;
@include t-align-items(stretch);
@@ -42,14 +44,36 @@
//Links
&__link {
- @extend %s-font--style-button;
- @include t-align-items(center);
display: none;
- padding: 1em;
+ @include t-align-items(center);
color: $s-color--navbar__text;
+ position: relative;
+ padding: 1em;
+
+ &:after {
+ position: absolute;
+ width: 100%;
+ height: 0px;
+ left: 0;
+ bottom: 0px;
+ @include t-translate-y(100%)
+ transition: height 0.2s $s-animation--ease-out;
+
+ content: " ";
+ }
+
+ &.is-active:after {
+ background: $s-color--navbar__bar-hover;
+ height: $o-navbar--link-thickness;
+ }
&:hover {
color: $s-color--navbar__text-hover;
+
+ &:after {
+ background: $s-color--navbar__bar-hover;
+ height: $o-navbar--link-thickness;
+ }
}
}