-
Notifications
You must be signed in to change notification settings - Fork 142
Expand file tree
/
Copy pathExamplesSideNav.tsx
More file actions
60 lines (54 loc) · 1.33 KB
/
ExamplesSideNav.tsx
File metadata and controls
60 lines (54 loc) · 1.33 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
import React, { useEffect, useState } from 'react';
import SideNavigation from './index';
const ExamplesSideNav = () => {
const [activeId, setActiveId] = useState('basic-pipeline');
useEffect(() => {
if (typeof window !== 'undefined') {
const path = window.location.pathname;
const filename = path.split('/').pop();
if (filename) {
const match = filename.match(/example(\d+)/);
if (match && match[1]) {
setActiveId(`example${match[1]}`);
}
}
}
}, []);
const items = [
{
id: 'basic-pipeline',
title: 'Basic pipeline',
href: 'basic-pipeline.html'
},
{
id: 'mixing-scripting-languages',
title: 'Mixed script pipeline',
href: 'mixing-scripting-languages.html'
},
{
id: 'blast-pipeline',
title: 'BLAST pipeline',
href: 'blast-pipeline.html'
},
{
id: 'rna-seq-pipeline',
title: 'RNA-Seq pipeline',
href: 'rna-seq-pipeline.html'
},
{
id: 'machine-learning-pipeline',
title: 'Machine Learning pipeline',
href: 'machine-learning-pipeline.html'
}
];
return (
<SideNavigation
items={items}
title="All examples"
activeItem={activeId}
className="font-sans text-sm"
mode="page"
/>
);
};
export default ExamplesSideNav;