Skip to content

Commit

Permalink
feat(ui): no results case
Browse files Browse the repository at this point in the history
  • Loading branch information
stdword committed Nov 3, 2023
1 parent bb2b1f1 commit 54abc7b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/ui/insert.css
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ div {
position: relative;
}

.nothing {
padding-bottom: 1rem;
padding-left: 1rem;
padding-right: 1rem;
}

.item {
word-break: break-all;

Expand Down
8 changes: 5 additions & 3 deletions src/ui/insert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ function InsertUI({ blockUUID }) {
const [searchQueryState, setSearchQueryState] = useState('')
const [resultsState, setResultsState] = useState([] as string[])
const [highlightedIndexState, setHighlightedIndexState] = useState(null as number | null)
// const firstUpdate = useRef(true)

function showUI() {
// handle show/hide animation
Expand Down Expand Up @@ -194,7 +193,7 @@ function InsertUI({ blockUUID }) {
<div id="results-wrap">
<div id="results">
<div id="items">
{resultsState.map((item) => (
{resultsState.length ? resultsState.map((item) => (
<div className="item"
onClick={insertHighlightedItem}
onMouseDown={highlightItem}
Expand All @@ -209,7 +208,10 @@ function InsertUI({ blockUUID }) {
</div>
</span>
</div>
))}
)): <div className="nothing">
No results
</div>
}
</div>
</div>
</div>
Expand Down

0 comments on commit 54abc7b

Please sign in to comment.