AutosuggestInput: add icon to menu
This commit is contained in:
parent
4ef9a88f72
commit
23393710c7
3 changed files with 14 additions and 3 deletions
|
@ -7,6 +7,7 @@ import { isRtl } from '../rtl';
|
|||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
import classNames from 'classnames';
|
||||
import { List as ImmutableList } from 'immutable';
|
||||
import Icon from 'soapbox/components/icon';
|
||||
|
||||
const textAtCursorMatchesToken = (str, caretPosition, searchTokens) => {
|
||||
let word;
|
||||
|
@ -231,7 +232,11 @@ export default class AutosuggestInput extends ImmutablePureComponent {
|
|||
onMouseDown={this.handleMenuItemClick(item)}
|
||||
key={i}
|
||||
>
|
||||
{item.text}
|
||||
{item.icon && (
|
||||
<Icon src={item.icon} />
|
||||
)}
|
||||
|
||||
<span>{item.text}</span>
|
||||
</a>
|
||||
));
|
||||
};
|
||||
|
|
|
@ -90,7 +90,7 @@ class Search extends React.PureComponent {
|
|||
const { intl, value } = this.props;
|
||||
|
||||
return [
|
||||
{ text: intl.formatMessage(messages.action, { query: value }), action: this.handleSubmit },
|
||||
{ text: intl.formatMessage(messages.action, { query: value }), icon: require('@tabler/icons/icons/search.svg'), action: this.handleSubmit },
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,8 @@
|
|||
}
|
||||
|
||||
.autosuggest-input__action {
|
||||
display: block;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px;
|
||||
border-radius: 4px;
|
||||
font-weight: bold;
|
||||
|
@ -115,4 +116,9 @@
|
|||
&.selected {
|
||||
background-color: var(--brand-color--med);
|
||||
}
|
||||
|
||||
.svg-icon {
|
||||
margin-right: 8px;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue