Skip to content

Commit

Permalink
enhance(search): show entities as comma-separated list
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelgerber committed Apr 15, 2024
1 parent 250bc91 commit 6424fce
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
19 changes: 9 additions & 10 deletions site/search/Search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -321,20 +321,19 @@
}

.search-results__chart-hit-entities {
display: flex;
flex-wrap: wrap;
gap: 4px;
list-style: none;
font-size: 0.7em;
font-size: 0.8em;

li {
background-color: $blue-10;
padding: 4px 8px;
border-radius: 12px;
color: $blue-90;
display: inline;
color: $blue-50;

svg {
margin-right: 4px;
&::after {
content: ", ";
}

&:last-child::after {
content: "";
}
}
}
Expand Down
13 changes: 3 additions & 10 deletions site/search/SearchPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ import {
} from "./searchTypes.js"
import { EXPLORERS_ROUTE_FOLDER } from "../../explorer/ExplorerConstants.js"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome/index.js"
import {
faHeartBroken,
faLocationDot,
faSearch,
} from "@fortawesome/free-solid-svg-icons"
import { faHeartBroken, faSearch } from "@fortawesome/free-solid-svg-icons"
import {
DEFAULT_SEARCH_PLACEHOLDER,
getIndexName,
Expand Down Expand Up @@ -118,7 +114,7 @@ function ChartHit({ hit }: { hit: IChartHit }) {
[hit.slug, entities]
)
const previewUrl = queryStr
? `/grapher/thumbnail/${hit.slug}${queryStr}`
? `/grapher/thumbnail/${hit.slug}${queryStr}` // TODO extract to .env
: `${BAKED_GRAPHER_URL}/exports/${hit.slug}.svg`

useEffect(() => {
Expand Down Expand Up @@ -163,10 +159,7 @@ function ChartHit({ hit }: { hit: IChartHit }) {
{entities.length > 0 && (
<ul className="search-results__chart-hit-entities">
{entities.map((entity) => (
<li key={entity}>
<FontAwesomeIcon icon={faLocationDot} />
{entity}
</li>
<li key={entity}>{entity}</li>
))}
</ul>
)}
Expand Down

0 comments on commit 6424fce

Please sign in to comment.