kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Search: autofocus
rodzic
4dbc4247f1
commit
e36dc0d119
|
@ -57,9 +57,14 @@ class Search extends React.PureComponent {
|
||||||
onClear: PropTypes.func.isRequired,
|
onClear: PropTypes.func.isRequired,
|
||||||
onShow: PropTypes.func.isRequired,
|
onShow: PropTypes.func.isRequired,
|
||||||
openInRoute: PropTypes.bool,
|
openInRoute: PropTypes.bool,
|
||||||
|
autoFocus: PropTypes.bool,
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.object.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static defaultProps = {
|
||||||
|
autoFocus: false,
|
||||||
|
}
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
expanded: false,
|
expanded: false,
|
||||||
};
|
};
|
||||||
|
@ -100,7 +105,7 @@ class Search extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { intl, value, submitted } = this.props;
|
const { intl, value, autoFocus, submitted } = this.props;
|
||||||
const { expanded } = this.state;
|
const { expanded } = this.state;
|
||||||
const hasValue = value.length > 0 || submitted;
|
const hasValue = value.length > 0 || submitted;
|
||||||
|
|
||||||
|
@ -117,6 +122,7 @@ class Search extends React.PureComponent {
|
||||||
onKeyUp={this.handleKeyUp}
|
onKeyUp={this.handleKeyUp}
|
||||||
onFocus={this.handleFocus}
|
onFocus={this.handleFocus}
|
||||||
onBlur={this.handleBlur}
|
onBlur={this.handleBlur}
|
||||||
|
autoFocus={autoFocus}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<div role='button' tabIndex='0' className='search__icon' onClick={this.handleClear}>
|
<div role='button' tabIndex='0' className='search__icon' onClick={this.handleClear}>
|
||||||
|
|
|
@ -12,7 +12,7 @@ const messages = defineMessages({
|
||||||
const Search = ({ intl }) => (
|
const Search = ({ intl }) => (
|
||||||
<div className='column search-page'>
|
<div className='column search-page'>
|
||||||
<ColumnHeader icon='search' title={intl.formatMessage(messages.heading)} />
|
<ColumnHeader icon='search' title={intl.formatMessage(messages.heading)} />
|
||||||
<SearchContainer autoSubmit />
|
<SearchContainer autoFocus autoSubmit />
|
||||||
<SearchResultsContainer />
|
<SearchResultsContainer />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
Ładowanie…
Reference in New Issue