Skip to content

Commit

Permalink
feat: make hint fixed on bottom of dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonella Sgarlatta committed May 26, 2021
1 parent 6d865bc commit f7bc9e0
Showing 1 changed file with 30 additions and 28 deletions.
58 changes: 30 additions & 28 deletions app/assets/javascripts/components/AutocompleteTagInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,36 +97,38 @@ export const AutocompleteTagInput: FunctionalComponent<Props> = ({
{dropdownVisible && (
<DisclosurePanel
ref={dropdownRef}
className="sn-dropdown flex flex-col py-2 overflow-y-scroll absolute"
className="sn-dropdown flex flex-col py-2 absolute"
style={{ maxHeight: dropdownMaxHeight }}
>
{tagResults.map((tag) => {
return (
<button
key={tag.uuid}
type="button"
className="sn-dropdown-item"
onClick={() => onTagOptionClick(tag)}
onBlur={closeOnBlur}
>
<Icon type="hashtag" className="color-neutral mr-2" />
{tag.title
.split(new RegExp(`(${searchQuery})`, 'gi'))
.map((substring, index) => (
<span
key={index}
className={
substring.toLowerCase() === searchQuery.toLowerCase()
? 'font-bold whitespace-pre-wrap'
: 'whitespace-pre-wrap'
}
>
{substring}
</span>
))}
</button>
);
})}
<div className="overflow-y-scroll">
{tagResults.map((tag) => {
return (
<button
key={tag.uuid}
type="button"
className="sn-dropdown-item"
onClick={() => onTagOptionClick(tag)}
onBlur={closeOnBlur}
>
<Icon type="hashtag" className="color-neutral mr-2" />
{tag.title
.split(new RegExp(`(${searchQuery})`, 'gi'))
.map((substring, index) => (
<span
key={index}
className={
substring.toLowerCase() === searchQuery.toLowerCase()
? 'font-bold whitespace-pre-wrap'
: 'whitespace-pre-wrap'
}
>
{substring}
</span>
))}
</button>
);
})}
</div>
{hintVisible && (
<>
{tagResults.length > 0 && (
Expand Down

0 comments on commit f7bc9e0

Please sign in to comment.