-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathlink.js
More file actions
37 lines (35 loc) · 726 Bytes
/
Copy pathlink.js
File metadata and controls
37 lines (35 loc) · 726 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';
function Link({
id = undefined,
children,
className = undefined,
fragment = false,
fragmentStyle = undefined,
fragmentIndex = undefined,
href = undefined,
slide = undefined,
}) {
return (
<a
data-id={id}
id={id}
href={
href ||
`#/${
typeof slide === 'string'
? parseInt(slide, 10) - 1
: `${parseInt(slide[0], 10) - 1}/${parseInt(slide[1], 10) - 1}`
}`
}
className={
className +
(fragment ? ' fragment' : '') +
(fragmentStyle ? ` ${fragmentStyle}` : '')
}
data-fragment-index={fragmentIndex}
>
{children}
</a>
);
}
export default Link;