2017-06-06 23:19:12 +02:00
|
|
|
import React from "react";
|
|
|
|
import Link from "component/link";
|
2017-05-05 07:28:28 +02:00
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
const SubHeader = props => {
|
2017-06-06 23:19:12 +02:00
|
|
|
const { subLinks, currentPage, navigate, modifier } = props;
|
2017-05-05 07:28:28 +02:00
|
|
|
|
2017-06-06 23:19:12 +02:00
|
|
|
const links = [];
|
2017-05-05 07:28:28 +02:00
|
|
|
|
2017-06-06 23:19:12 +02:00
|
|
|
for (let link of Object.keys(subLinks)) {
|
2017-05-05 07:28:28 +02:00
|
|
|
links.push(
|
2017-06-06 23:19:12 +02:00
|
|
|
<Link
|
|
|
|
onClick={event => navigate(`/${link}`, event)}
|
|
|
|
key={link}
|
|
|
|
className={
|
|
|
|
link == currentPage ? "sub-header-selected" : "sub-header-unselected"
|
|
|
|
}
|
|
|
|
>
|
2017-05-05 07:28:28 +02:00
|
|
|
{subLinks[link]}
|
2017-05-06 18:31:47 +02:00
|
|
|
</Link>
|
2017-06-06 23:19:12 +02:00
|
|
|
);
|
2017-05-05 07:28:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2017-06-06 23:19:12 +02:00
|
|
|
<nav
|
|
|
|
className={"sub-header" + (modifier ? " sub-header--" + modifier : "")}
|
|
|
|
>
|
2017-05-05 07:28:28 +02:00
|
|
|
{links}
|
|
|
|
</nav>
|
2017-06-06 23:19:12 +02:00
|
|
|
);
|
2017-06-06 06:21:55 +02:00
|
|
|
};
|
2017-05-05 07:28:28 +02:00
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
export default SubHeader;
|