Skip to content

Commit 29c962e

Browse files
committed
feat: add icon and tooltip to repo buttons
1 parent c09c2ef commit 29c962e

File tree

2 files changed

+68
-21
lines changed

2 files changed

+68
-21
lines changed

src/components/lbe/FilterSection.js

+66-21
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,78 @@
11
import React from "react";
22

3-
43
// Custom functions
54

65
import { TextSearch, FilterButton } from "./LbeElements.js";
76

8-
97
// Assemble buttons for filtering section
108

11-
function LbeButtons( {repos, subdiscs, journals, lbeState, setLbeState} ) {
12-
return(
13-
<React.Fragment>
14-
<div className="lbe__searchfilter__section"><h4>Filter by repositories</h4><p>{repos.map((props, idx) => <FilterButton key={idx} name={props} type="repo" numbered={true} {...{lbeState, setLbeState}} />)}</p></div>
15-
<div className="lbe__searchfilter__section"><h4>Filter by subdisciplines</h4><p>{subdiscs.map((props, idx) => <FilterButton key={idx} name={props} type="subd" numbered={true} {...{lbeState, setLbeState}} />)}</p></div>
16-
<div className="lbe__searchfilter__section"><h4>Filter by journals</h4><p>{journals.map((props, idx) => <FilterButton key={idx} name={props} type="journal" numbered={true} {...{lbeState, setLbeState}} />)}</p></div>
17-
</React.Fragment>
18-
)
9+
function LbeButtons({ repos, subdiscs, journals, lbeState, setLbeState }) {
10+
return (
11+
<React.Fragment>
12+
<div className="lbe__searchfilter__section">
13+
<h4>Filter by repositories</h4>
14+
<p>
15+
{repos.map((props, idx) => (
16+
<FilterButton
17+
key={idx}
18+
name={props}
19+
type="repo"
20+
numbered={true}
21+
{...{ lbeState, setLbeState }}
22+
/>
23+
))}
24+
</p>
25+
</div>
26+
<div className="lbe__searchfilter__section">
27+
<h4>Filter by subdisciplines</h4>
28+
<p>
29+
{subdiscs.map((props, idx) => (
30+
<FilterButton
31+
key={idx}
32+
name={props}
33+
type="subd"
34+
numbered={true}
35+
{...{ lbeState, setLbeState }}
36+
/>
37+
))}
38+
</p>
39+
</div>
40+
<div className="lbe__searchfilter__section">
41+
<h4>Filter by journals</h4>
42+
<p>
43+
{journals.map((props, idx) => (
44+
<FilterButton
45+
key={idx}
46+
name={props}
47+
type="journal"
48+
numbered={true}
49+
{...{ lbeState, setLbeState }}
50+
/>
51+
))}
52+
</p>
53+
</div>
54+
</React.Fragment>
55+
);
1956
}
2057

21-
function FilterSection( {repos, subdiscs, journals, lbeState, setLbeState, resultOutput} ) {
22-
23-
return(
24-
<div className="lbe__searchfilter">
25-
<div className="lbe__searchfilter__container">
26-
<TextSearch {...{lbeState,setLbeState,resultOutput}} />
27-
<LbeButtons {...{repos, subdiscs, journals, lbeState, setLbeState}} />
28-
</div>
29-
</div>
30-
)
58+
function FilterSection({
59+
repos,
60+
subdiscs,
61+
journals,
62+
lbeState,
63+
setLbeState,
64+
resultOutput,
65+
}) {
66+
return (
67+
<div className="lbe__searchfilter">
68+
<div className="lbe__searchfilter__container">
69+
<TextSearch {...{ lbeState, setLbeState, resultOutput }} />
70+
<LbeButtons
71+
{...{ repos, subdiscs, journals, lbeState, setLbeState }}
72+
/>
73+
</div>
74+
</div>
75+
);
3176
}
3277

33-
export default FilterSection;
78+
export default FilterSection;

src/components/lbe/LbeBody.js

+2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ function LbeBlock({
6161
name={m}
6262
type="repo"
6363
numbered={false}
64+
funnel
65+
title={"Filter datasets from " + m}
6466
{...{ lbeState, setLbeState }}
6567
/>
6668
))}

0 commit comments

Comments
 (0)