mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-22 09:37:17 +00:00
Focus input on /
This commit is contained in:
parent
46546dfa84
commit
a4786eafef
3 changed files with 37 additions and 1 deletions
3
.netlify/state.json
Normal file
3
.netlify/state.json
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"siteId": "be420a16-4ef3-43b1-ac62-35869bdf8679"
|
||||
}
|
||||
|
|
@ -1,10 +1,39 @@
|
|||
import React from "react";
|
||||
import * as React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import * as Utils from "./utils";
|
||||
import * as Selectors from "./redux/selectors";
|
||||
import * as Actions from "./redux/actionCreators";
|
||||
import Disposable from "./Disposable";
|
||||
|
||||
class Header extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this._disposable = new Disposable();
|
||||
this._inputRef = null;
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const handler = e => {
|
||||
// slash
|
||||
if (e.keyCode === 191) {
|
||||
if (this._inputRef == null) {
|
||||
return;
|
||||
}
|
||||
if (this._inputRef !== document.activeElement) {
|
||||
this._inputRef.focus();
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
};
|
||||
window.document.addEventListener("keydown", handler);
|
||||
this._disposable.add(() => {
|
||||
window.document.removeEventListener("keydown", handler);
|
||||
});
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this._disposable.dispose();
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
<div id="search">
|
||||
|
|
@ -28,6 +57,9 @@ class Header extends React.Component {
|
|||
onChange={e => this.props.setSearchQuery(e.target.value)}
|
||||
value={this.props.searchQuery || ""}
|
||||
placeholder={"Search..."}
|
||||
ref={node => {
|
||||
this._inputRef = node;
|
||||
}}
|
||||
/>
|
||||
<button
|
||||
onClick={() => {
|
||||
|
|
|
|||
1
todo.md
1
todo.md
|
|
@ -1,5 +1,6 @@
|
|||
# TODO
|
||||
|
||||
- Sort skins by... something? (Twitter likes?)
|
||||
- Scroll is not locked in overlay mode on ios
|
||||
- Add an about page
|
||||
- Add share link to focused mode
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue