ssb: Make the search box behave better on mobile.
Some checks failed
Build Tilde Friends / Build-All (push) Has been cancelled
Some checks failed
Build Tilde Friends / Build-All (push) Has been cancelled
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"type": "tildefriends-app",
|
"type": "tildefriends-app",
|
||||||
"emoji": "🦀",
|
"emoji": "🦀",
|
||||||
"previous": "&rq/9Dr780VM2+ozyeKZI4nq2t83JRgemzlJINlYYP4c=.sha256"
|
"previous": "&Do4vIjdE5vJgJ+fIZ10zOeDQcqNd+VUacQl2wzRjGhw=.sha256"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -753,7 +753,13 @@ class TfElement extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
search() {
|
search() {
|
||||||
this.set_hash('#q=' + this.renderRoot.getElementById('search_text').value);
|
let search_text = this.renderRoot.getElementById('search_text');
|
||||||
|
if (!search_text.value.length) {
|
||||||
|
search_text.focus();
|
||||||
|
this.set_tab('search');
|
||||||
|
} else {
|
||||||
|
this.set_hash('#q=' + search_text.value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
search_keydown(event) {
|
search_keydown(event) {
|
||||||
@@ -825,8 +831,8 @@ class TfElement extends LitElement {
|
|||||||
`
|
`
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
<button class="w3-bar-item w3-button w3-right" @click=${this.search}>🔍Search</button>
|
<button class="w3-bar-item w3-button w3-right" @click=${this.search}>🔍<span class="w3-hide-small">Search</span></button>
|
||||||
<input type="text" class="w3-input w3-bar-item w3-right w3-theme-d1" placeholder="keywords, @id, #channel" id="search_text" @keydown=${this.search_keydown}></input>
|
<input type="text" class=${'w3-input w3-bar-item w3-right w3-theme-d1' + (this.tab == 'search' ? ' w3-mobile' : ' w3-hide-small')} placeholder="keywords, @id, #channel" id="search_text" @keydown=${this.search_keydown}></input>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
let contents = this.guest
|
let contents = this.guest
|
||||||
|
|||||||
Reference in New Issue
Block a user