This repository has been archived by the owner on Sep 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df0ccd6
commit ef1c2c8
Showing
7 changed files
with
190 additions
and
45 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,30 @@ | ||
<div class="row"> | ||
<div class="col-md-9"> | ||
<div class="feed-toggle"> | ||
<ul id="feedOptions" class="nav nav-pills outline-active"> | ||
<!--<li class="nav-item">--> | ||
<!--<a class="nav-link disabled" href="">Your Feed</a>--> | ||
<!--</li>--> | ||
<li class="nav-item"> | ||
<a class="nav-link active" href="">Global Feed</a> | ||
</li> | ||
</ul> | ||
</div> | ||
<div id="globalFeed"> | ||
</div> | ||
</div> | ||
<div> | ||
<c-banner></c-banner> | ||
<div class="container page"> | ||
<div class="row"> | ||
<div class="col-md-9"> | ||
<div class="feed-toggle"> | ||
<ul id="feedOptions" class="nav nav-pills outline-active"> | ||
<!--<li class="nav-item">--> | ||
<!--<a class="nav-link disabled" href="">Your Feed</a>--> | ||
<!--</li>--> | ||
<li class="nav-item"> | ||
<a class="nav-link active" href="">Global Feed</a> | ||
</li> | ||
</ul> | ||
</div> | ||
<div id="globalFeed"> | ||
</div> | ||
</div> | ||
|
||
<div class="col-md-3"> | ||
<div class="sidebar"> | ||
<p>Popular Tags</p> | ||
<div id="tagList" class="tag-list"> | ||
<div class="col-md-3"> | ||
<div class="sidebar"> | ||
<p>Popular Tags</p> | ||
<div id="tagList" class="tag-list"> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
|
||
</div> |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = ` | ||
<div class="auth-page"> | ||
<div class="container page"> | ||
<div class="row"> | ||
<div class="col-md-6 offset-md-3 col-xs-12"> | ||
<h1 class="text-xs-center">Sign up</h1> | ||
<p class="text-xs-center"> | ||
<a href="">Have an account?</a> | ||
</p> | ||
<!--<ul class="error-messages">--> | ||
<!--<li>That email is already taken</li>--> | ||
<!--</ul>--> | ||
<form> | ||
<fieldset class="form-group"> | ||
<input class="form-control form-control-lg" type="text" placeholder="Your Name"> | ||
</fieldset> | ||
<fieldset class="form-group"> | ||
<input class="form-control form-control-lg" type="text" placeholder="Email"> | ||
</fieldset> | ||
<fieldset class="form-group"> | ||
<input class="form-control form-control-lg" type="password" placeholder="Password"> | ||
</fieldset> | ||
<button class="btn btn-lg btn-primary pull-xs-right"> | ||
Sign up | ||
</button> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
`; | ||
this.innerHTML = template; | ||
} | ||
|
||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); |