blob: 6aade15334c3520ad0ed175dee4a658492098f02 (
plain) (
blame)
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
|
import React from "react";
import { Link } from "react-router-dom";
import styles from "./Sidebar.module.css";
import {
SearchIcon,
} from "../../images/Images";
import links from "./Links";
interface ContentProps {
isSearching: boolean;
selectedButtonIndex: number
handle_sidebar_click: (clicked_sidebar_idx: number) => void;
};
const _Content: React.FC<ContentProps> = ({ isSearching, selectedButtonIndex, handle_sidebar_click }) => {
return (
<div className="md:h-full">
<div className="px-2 my-2.5">
<button onClick={() => handle_sidebar_click(0)} className={`${styles.button} ${selectedButtonIndex == 0 ? styles["button-selected"] : ""} ${isSearching ? styles["button-hidden"] : ""}`}>
<img src={SearchIcon} alt="Search" />
<span>Search</span>
</button>
</div>
<div className="flex-1 min-w-0 mt-12">
<nav className="px-2 flex flex-col gap-2">
{links.content.map(({ to, icon, label }, i) => (
<Link to={to} tabIndex={-1} key={i + 1}>
<button
className={`${styles.button} ${selectedButtonIndex == i + 1 ? styles["button-selected"] : ""} ${isSearching ? styles["button-hidden"] : ""}`}
onClick={() => handle_sidebar_click(i + 1)}
>
<img src={icon} />
<span>
{label}
</span>
</button>
</Link>
))}
</nav>
</div>
</div>
);
}
export default _Content;
|