-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathBreadcrumbs.tsx
More file actions
37 lines (31 loc) · 978 Bytes
/
Breadcrumbs.tsx
File metadata and controls
37 lines (31 loc) · 978 Bytes
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
import React from 'react';
import { Link } from 'react-router-dom';
import styles from './Breadcrumbs.module.scss';
type Props = {
category: string;
lastItem?: string;
};
export const Breadcrumbs: React.FC<Props> = ({ category, lastItem }) => {
const categoryName = category.charAt(0).toUpperCase() + category.slice(1);
return (
<div className={styles.breadcrumbs} data-cy="breadCrumbs">
<Link to="/" className={styles.homeLink}>
<img src="img/icons/Home.png" alt="Home" />
</Link>
<div className={styles.separator}>
<img src="img/icons/ArrowRight.png" alt=">" />
</div>
<Link to={`/${category}`} className={styles.link}>
{categoryName}
</Link>
{lastItem && (
<>
<div className={styles.separator}>
<img src="img/icons/ArrowRight.png" alt=">" />
</div>
<span className={styles.lastItem}>{lastItem}</span>
</>
)}
</div>
);
};