+
+
-
-
-
\ No newline at end of file
diff --git a/client/pages/home.comp.js b/client/pages/home.comp.js
index 7017b05..eda8756 100644
--- a/client/pages/home.comp.js
+++ b/client/pages/home.comp.js
@@ -106,8 +106,8 @@ export class HomeComponent extends HTMLElement {
createNewTagElement(tag) {
const tagEl = document.createElement('a');
tagEl.className = 'tag-pill tag-default';
- tagEl.href = '#';
tagEl.innerHTML = tag;
+ tagEl.style="cursor: pointer;";
return tagEl;
}
diff --git a/client/pages/login.comp.js b/client/pages/login.comp.js
new file mode 100644
index 0000000..8558c75
--- /dev/null
+++ b/client/pages/login.comp.js
@@ -0,0 +1,56 @@
+"use strict";
+export class CLoginComponent extends HTMLElement {
+ constructor() {
+ super();
+ // this.shadow = this.createShadowRoot();
+ }
+
+ static get observedAttributes() {
+ return [];
+ }
+
+ attributeChangedCallback(name, oldValue, newValue) {
+
+ }
+
+ connectedCallback() {
+ var template = `
+
+ `;
+ this.innerHTML = template;
+ }
+
+
+}
diff --git a/client/router/router-handler.js b/client/router/router-handler.js
index 925b165..3b0cee3 100644
--- a/client/router/router-handler.js
+++ b/client/router/router-handler.js
@@ -1,3 +1,64 @@
+import {HomeComponent} from "../pages/home.comp";
+import {CLoginComponent} from "../pages/login.comp";
export class RouterHandler {
+ constructor() {
+ var pushState = history.pushState;
+ history.pushState = function (state, a, b) {
+ if (typeof history.onpushstate == "function") {
+ history.onpushstate({state: state}, a, b);
+ }
+ return pushState.apply(history, arguments);
+ };
+ window.onpopstate = history.onpushstate = (state, a, url) => {
+ let routeTo = null;
+ if (state.state != null && state.state.route != undefined) {
+ routeTo = state.state.route;
+ } else if(url != undefined) {
+ routeTo = url;
+ }
+ RouterHandler.handleButtonChanges(routeTo);
+ RouterHandler._onChangeCallbacks.forEach(c => {
+ c(routeTo);
+ });
+ // }
+ };
+ }
+
+ static onChange(callback) {
+ RouterHandler._onChangeCallbacks.push(callback);
+ }
+
+ static handleButtonChanges(url) {
+ let page = null;
+
+ if (url == undefined || url == '/') {
+ page = new HomeComponent();
+ } else {
+ page = new CLoginComponent();
+ }
+ const outlet = document.querySelector('router-outlet');
+ while (outlet.firstChild) {
+ outlet.removeChild(outlet.firstChild);
+ }
+ outlet.appendChild(page);
+ }
+
+ static navigate(url) {
+ let page = null;
+
+ if (url == '/') {
+ page = new HomeComponent();
+ } else {
+ page = new CLoginComponent();
+ }
+ const outlet = document.querySelector('router-outlet');
+ while (outlet.firstChild) {
+ outlet.removeChild(outlet.firstChild);
+ }
+ // history.pushState({}, null, url);
+ outlet.appendChild(page);
+ }
}
+RouterHandler._onChangeCallbacks = [];
+new RouterHandler();
\ No newline at end of file