-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathExplorePanel.tsx
More file actions
62 lines (56 loc) · 1.66 KB
/
ExplorePanel.tsx
File metadata and controls
62 lines (56 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import React from "react";
import {
EuiHorizontalRule,
EuiPanel,
EuiTitle,
EuiBadge,
EuiSkeletonText,
EuiFlexGroup,
EuiFlexItem,
EuiSpacer,
} from "@elastic/eui";
import { useNavigate } from "react-router-dom";
import useFCOExploreSuggestions from "../hooks/useFCOExploreSuggestions";
const ExplorePanel = () => {
const { isLoading, isSuccess, data } = useFCOExploreSuggestions();
const navigate = useNavigate();
return (
<EuiPanel>
<EuiTitle size="xs">
<h3>Explore this Project</h3>
</EuiTitle>
<EuiHorizontalRule margin="xs" />
{isLoading && <EuiSkeletonText lines={3} />}
{isSuccess &&
data &&
data.map((suggestionGroup, i) => {
return (
<React.Fragment key={i}>
<EuiTitle size="xxs">
<h4>{suggestionGroup.title}</h4>
</EuiTitle>
<EuiFlexGroup wrap responsive={false} gutterSize="xs">
{suggestionGroup.items.map((item, j) => {
return (
<EuiFlexItem grow={false} key={j}>
<EuiBadge
color="primary"
onClick={() => {
navigate(item.link);
}}
onClickAriaLabel={item.label}
>
{item.name} ({item.count})
</EuiBadge>
</EuiFlexItem>
);
})}
</EuiFlexGroup>
<EuiSpacer size="s" />
</React.Fragment>
);
})}
</EuiPanel>
);
};
export default ExplorePanel;