Added search UI
This commit is contained in:
parent
b17f54e65c
commit
1598ebd93b
@ -5,7 +5,7 @@ component Navigation(user *arn.User)
|
|||||||
LoggedInMenu(user)
|
LoggedInMenu(user)
|
||||||
|
|
||||||
component LoggedOutMenu
|
component LoggedOutMenu
|
||||||
nav#navigation
|
nav#navigation.logged-out
|
||||||
NavigationButton("About", "/", "question-circle")
|
NavigationButton("About", "/", "question-circle")
|
||||||
NavigationButton("Anime", "/anime", "television")
|
NavigationButton("Anime", "/anime", "television")
|
||||||
NavigationButton("Forum", "/forum", "comment")
|
NavigationButton("Forum", "/forum", "comment")
|
||||||
@ -13,22 +13,27 @@ component LoggedOutMenu
|
|||||||
NavigationButton("Airing", "/airing", "th")
|
NavigationButton("Airing", "/airing", "th")
|
||||||
|
|
||||||
component LoggedInMenu(user *arn.User)
|
component LoggedInMenu(user *arn.User)
|
||||||
nav#navigation
|
nav#navigation.logged-in
|
||||||
NavigationButton("Dash", "/", "inbox")
|
ExtraNavigationButton("Dash", "/", "inbox")
|
||||||
NavigationButton("Anime", "/anime", "television")
|
ExtraNavigationButton("Anime", "/anime", "television")
|
||||||
NavigationButton("Profile", "/+", "user")
|
ExtraNavigationButton("Profile", "/+", "user")
|
||||||
NavigationButton("Forum", "/forum", "comment")
|
ExtraNavigationButton("Forum", "/forum", "comment")
|
||||||
NavigationButton("Settings", "/settings", "cog")
|
|
||||||
|
FuzzySearch
|
||||||
|
|
||||||
.extra-navigation
|
.extra-navigation
|
||||||
|
//- if user.Role == "admin"
|
||||||
|
//- ExtraNavigationButton("Admin", "/admin", "wrench")
|
||||||
|
|
||||||
ExtraNavigationButton("Users", "/users", "globe")
|
ExtraNavigationButton("Users", "/users", "globe")
|
||||||
ExtraNavigationButton("Airing", "/airing", "th")
|
ExtraNavigationButton("Airing", "/airing", "th")
|
||||||
|
ExtraNavigationButton("Settings", "/settings", "cog")
|
||||||
if user.Role == "admin"
|
|
||||||
ExtraNavigationButton("Admin", "/admin", "wrench")
|
|
||||||
|
|
||||||
NavigationButtonNoAJAX("Logout", "/logout", "sign-out")
|
NavigationButtonNoAJAX("Logout", "/logout", "sign-out")
|
||||||
|
|
||||||
|
component FuzzySearch
|
||||||
|
input#search(type="text", placeholder="Search...", title="Shortcut: Ctrl + Q")
|
||||||
|
|
||||||
component NavigationButton(name string, target string, icon string)
|
component NavigationButton(name string, target string, icon string)
|
||||||
a.navigation-link.ajax(href=target, aria-label=name)
|
a.navigation-link.ajax(href=target, aria-label=name)
|
||||||
.navigation-button
|
.navigation-button
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#search-container
|
// #search-container
|
||||||
horizontal
|
// horizontal
|
||||||
justify-content center
|
// justify-content center
|
||||||
|
|
||||||
#search
|
// #search
|
||||||
width 100%
|
// width 100%
|
||||||
max-width 560px
|
// max-width 560px
|
@ -56,6 +56,19 @@ export class AnimeNotifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onKeyDown(e: KeyboardEvent) {
|
||||||
|
// Ctrl + Q = Search
|
||||||
|
if(e.ctrlKey && e.keyCode == 81) {
|
||||||
|
let search = this.app.find("search") as HTMLInputElement
|
||||||
|
|
||||||
|
search.focus()
|
||||||
|
search.select()
|
||||||
|
|
||||||
|
e.preventDefault()
|
||||||
|
e.stopPropagation()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
updateAvatars() {
|
updateAvatars() {
|
||||||
for(let element of findAll(".user-image")) {
|
for(let element of findAll(".user-image")) {
|
||||||
let img = element as HTMLImageElement
|
let img = element as HTMLImageElement
|
||||||
|
@ -6,6 +6,7 @@ let arn = new AnimeNotifier(app)
|
|||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", arn.onContentLoaded.bind(arn))
|
document.addEventListener("DOMContentLoaded", arn.onContentLoaded.bind(arn))
|
||||||
document.addEventListener("readystatechange", arn.onReadyStateChange.bind(arn))
|
document.addEventListener("readystatechange", arn.onReadyStateChange.bind(arn))
|
||||||
|
document.addEventListener("keydown", arn.onKeyDown.bind(arn), false)
|
||||||
|
|
||||||
window.addEventListener("popstate", arn.onPopState.bind(arn))
|
window.addEventListener("popstate", arn.onPopState.bind(arn))
|
||||||
// window.addEventListener("resize", arn.onResize.bind(arn))
|
// window.addEventListener("resize", arn.onResize.bind(arn))
|
@ -1,6 +1,6 @@
|
|||||||
input, textarea, button, select
|
input, textarea, button, select
|
||||||
font-family inherit
|
font-family inherit
|
||||||
font-size 1rem
|
font-size 1em
|
||||||
padding 0.4em 0.8em
|
padding 0.4em 0.8em
|
||||||
border-radius 3px
|
border-radius 3px
|
||||||
color text-color
|
color text-color
|
||||||
|
@ -42,6 +42,17 @@
|
|||||||
.navigation-text
|
.navigation-text
|
||||||
display none
|
display none
|
||||||
|
|
||||||
|
#search
|
||||||
|
display none
|
||||||
|
border-radius 0
|
||||||
|
background text-color
|
||||||
|
border none
|
||||||
|
color white
|
||||||
|
|
||||||
|
:focus
|
||||||
|
border none !important
|
||||||
|
box-shadow none
|
||||||
|
|
||||||
.extra-navigation
|
.extra-navigation
|
||||||
display none
|
display none
|
||||||
|
|
||||||
@ -59,20 +70,25 @@
|
|||||||
> 930px
|
> 930px
|
||||||
.navigation-button
|
.navigation-button
|
||||||
font-size 1.1em
|
font-size 1.1em
|
||||||
|
|
||||||
.icon
|
|
||||||
margin-right 0.5em
|
|
||||||
|
|
||||||
#navigation
|
#navigation
|
||||||
justify-content flex-start
|
justify-content flex-start
|
||||||
|
|
||||||
.navigation-text
|
.logged-out
|
||||||
display inline-block
|
.navigation-text
|
||||||
|
display inline-block
|
||||||
|
|
||||||
|
.navigation-button
|
||||||
|
.icon
|
||||||
|
margin-right 0.5em
|
||||||
|
|
||||||
|
#search
|
||||||
|
display block
|
||||||
|
flex 1
|
||||||
|
|
||||||
.extra-navigation
|
.extra-navigation
|
||||||
horizontal
|
horizontal
|
||||||
justify-content flex-end
|
justify-content flex-end
|
||||||
flex 1
|
|
||||||
|
|
||||||
< 400px height
|
< 400px height
|
||||||
#navigation
|
#navigation
|
||||||
@ -84,4 +100,7 @@
|
|||||||
horizontal
|
horizontal
|
||||||
|
|
||||||
.extra-navigation
|
.extra-navigation
|
||||||
|
display none
|
||||||
|
|
||||||
|
#search
|
||||||
display none
|
display none
|
Loading…
Reference in New Issue
Block a user