Linting
This commit is contained in:
parent
3a3eb68566
commit
c6623291b6
1 changed files with 7 additions and 11 deletions
|
@ -1,29 +1,25 @@
|
|||
import React from 'react';
|
||||
|
||||
export default class Breadcrumbs extends React.Component {
|
||||
constructor() {
|
||||
super();
|
||||
this.urlParts = Object.freeze(location.pathname.split('/').slice(1, -1));
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.urlParts.length < 2) {
|
||||
const urlParts = Object.freeze(location.pathname.split('/').slice(1, -1));
|
||||
if (urlParts.length < 2) {
|
||||
return;
|
||||
}
|
||||
var elements = [];
|
||||
for (var i = 0; i < this.urlParts.length; i++) {
|
||||
for (var i = 0; i < urlParts.length; i++) {
|
||||
var dirs = [];
|
||||
for (var j = 0; j <= i; j++) {
|
||||
dirs.push(this.urlParts[j]);
|
||||
dirs.push(urlParts[j]);
|
||||
}
|
||||
if (i === (this.urlParts.length - 1)) {
|
||||
if (i === (urlParts.length - 1)) {
|
||||
elements.push(
|
||||
<li className="active" href={url}>{this.urlParts[i]}</li>
|
||||
<li className="active">{urlParts[i]}</li>
|
||||
);
|
||||
} else {
|
||||
var url = '/' + dirs.join('/') + '/';
|
||||
elements.push(
|
||||
<li><a href={url}>{this.urlParts[i]}</a></li>
|
||||
<li><a href={url}>{urlParts[i]}</a></li>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue