mirror of
https://github.com/chinchang/web-maker.git
synced 2025-08-05 04:47:32 +02:00
commandpalette: handle edge cases
This commit is contained in:
@@ -78,7 +78,7 @@ export class CommandPalette extends Component {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (e.which === ENTER_KEY) {
|
if (e.which === ENTER_KEY && this.state.list.length) {
|
||||||
this.selectOption(this.state.list[this.state.selectedIndex]);
|
this.selectOption(this.state.list[this.state.selectedIndex]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -118,6 +118,9 @@ export class CommandPalette extends Component {
|
|||||||
onKeyUp={this.keyDownHandler.bind(this)}
|
onKeyUp={this.keyDownHandler.bind(this)}
|
||||||
style="width:100%"
|
style="width:100%"
|
||||||
/>
|
/>
|
||||||
|
{!this.props.files.length && !this.state.list.length ? (
|
||||||
|
<p>Nothing to search here.</p>
|
||||||
|
) : null}
|
||||||
<ul class="command-palette__option-list">
|
<ul class="command-palette__option-list">
|
||||||
{this.state.list.map((item, index) => (
|
{this.state.list.map((item, index) => (
|
||||||
<Row
|
<Row
|
||||||
|
Reference in New Issue
Block a user