mirror of
https://github.com/urbit/shrub.git
synced 2024-12-01 14:42:02 +03:00
Merge pull request #3264 from urbit/mp/omni-tweak
omnibox: two UX tweaks
This commit is contained in:
commit
974a88385a
@ -10,6 +10,18 @@ export class OmniboxResult extends Component {
|
||||
hovered: false
|
||||
};
|
||||
this.setHover = this.setHover.bind(this);
|
||||
this.result = React.createRef();
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
const { props, state } = this;
|
||||
if (prevProps &&
|
||||
!state.hovered &&
|
||||
prevProps.selected !== props.selected &&
|
||||
props.selected === props.link
|
||||
) {
|
||||
this.result.current.scrollIntoView({ block: 'nearest' });
|
||||
}
|
||||
}
|
||||
|
||||
setHover(boolean) {
|
||||
@ -55,6 +67,7 @@ export class OmniboxResult extends Component {
|
||||
}
|
||||
onClick={navigate}
|
||||
width="100%"
|
||||
ref={this.result}
|
||||
>
|
||||
{this.state.hovered || selected === link ? (
|
||||
<>
|
||||
|
@ -100,6 +100,8 @@ export default function index(associations, apps) {
|
||||
const obj = result(apps[e].type.basic.title, apps[e].type.basic.linkedUrl, apps[e].type.basic.title, null);
|
||||
applications.push(obj);
|
||||
});
|
||||
// add groups separately
|
||||
applications.push(result('Groups', '/~groups', 'groups', null));
|
||||
index.set('apps', applications);
|
||||
|
||||
return index;
|
||||
|
Loading…
Reference in New Issue
Block a user