blob: b123d37feb9c8abcc1a9388ee96e5ec9f8fef8d4 (
plain)
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
|
const React = require('react');
module.exports = function FileBreadcrumbs({ fileFilter = '', setFileFilter }) {
const parts = fileFilter.split('/');
const breadcrumbs = [
{
path: '',
name: 'all files'
},
...parts.map((part, i) => ({
path: parts.slice(0, i + 1).join('/'),
name: part
}))
];
return breadcrumbs.map(({ path, name }) =>
path === fileFilter ? (
name
) : (
<>
<a
href="javascript:void(0)"
onClick={() => setFileFilter(path)}
>
{name}
</a>
/
</>
)
);
};
|