Skip to content

Commit

Permalink
make searches reflect expanded prop type (#953)
Browse files Browse the repository at this point in the history
* make searches reflect expanded proptype

* do it inline

* remove label

* Revert "remove label"

This reverts commit f8f28a7.

---------

Co-authored-by: casey1173 <caseyhansen1999@gmail.com>
  • Loading branch information
shapiromatron and caseyhans authored Nov 29, 2023
1 parent 41877a8 commit be7035f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions frontend/lit/components/Reference.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,15 @@ class Reference extends Component {
</div>
);

if (data.searches.length) {
if (!expanded && data.searches.length) {
nodes.push(
<div
style={{minWidth: 85}}
className="d-flex dropdown flex-shrink-0"
key={h.randomString()}>
<a
className={`btn dropdown-toggle ${btn_size} outline-btn`}
title="HAWC Searches/Imports"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false">
Expand All @@ -90,7 +91,7 @@ class Reference extends Component {
</a>
<div className="dropdown-menu dropdown-menu-right">
{data.searches.map((d, i) => (
<a className="dropdown-item small" key={h.randomString()} href={d.url}>
<a className="dropdown-item small" key={d.url} href={d.url}>
{d.title}
</a>
))}
Expand Down Expand Up @@ -207,6 +208,16 @@ class Reference extends Component {
))}
</p>
) : null}
{expanded && data.searches.length > 0 ? (
<div>
<label>Searches/imports:&nbsp;</label>
{data.searches.map((d, i) => (
<a className="btn btn-light mr-1 mb-2" key={d.url} href={d.url}>
{d.title}
</a>
))}
</div>
) : null}
{showHr ? <hr className="my-4" /> : null}
</div>
);
Expand Down

0 comments on commit be7035f

Please sign in to comment.