-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.tsx
45 lines (43 loc) · 1.25 KB
/
index.tsx
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
import { Ref } from 'react';
import { Link } from 'react-router-dom';
import homeIcon from '../../assets/icons/home-icon.svg';
import bookmarkIcon from '../../assets/icons/bookmark-light-orange-icon.svg';
import clearIcon from '../../assets/icons/clear-icon.svg';
interface SidebarProps {
isHomePage: boolean;
ref: Ref<HTMLElement>;
isOpen: boolean;
onClose: () => void;
}
export const Sidebar: React.FC<SidebarProps> = ({
isHomePage,
ref,
isOpen,
onClose,
}) => {
return (
<aside ref={ref} className={`sidebar ${isOpen && 'sidebar_visible'}`}>
<button onClick={onClose} className="button button-close">
<img src={clearIcon} alt="Clear icon" />
</button>
<nav>
<ul className="sidebar__navlist">
{!isHomePage && (
<li>
<Link to="/" className="sidebar__navlist__link">
<img src={homeIcon} alt="Home icon" />
<span>Home</span>
</Link>
</li>
)}
<li>
<Link to="/favorites" className="sidebar__navlist__link">
<img src={bookmarkIcon} alt="Bookmark icon" />
<span>Your favorites</span>
</Link>
</li>
</ul>
</nav>
</aside>
);
};