Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make searches reflect expanded prop type #953

Merged
merged 5 commits into from
Nov 29, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
{data.searches.map((d, i) => (
<a className="btn btn-light mr-1 mb-2" key={d.url} href={d.url}>
<i className="fa fa-cloud-download" aria-hidden="true"></i>&nbsp;
{d.title}
</a>
))}
</div>
) : null}
{showHr ? <hr className="my-4" /> : null}
</div>
);
Expand Down