| 1 |
import React from "react"; |
| 2 |
|
| 3 |
/** |
| 4 |
* Navigation header button component. |
| 5 |
* |
| 6 |
* @param {Object} props component properties |
| 7 |
* @param {string} props.title button title |
| 8 |
* @param {string} props.targetPath target path |
| 9 |
* @param {Function} props.onClickHandler click handler, will call with targetPath as first argument |
| 10 |
* @param {boolean} props.isActive button active status |
| 11 |
* @class |
| 12 |
*/ |
| 13 |
function NavigationHeaderButton({ |
| 14 |
title, |
| 15 |
targetPath, |
| 16 |
onClickHandler, |
| 17 |
isActive = false, |
| 18 |
}) { |
| 19 |
const onClickHandlerDefault = () => onClickHandler(targetPath); |
| 20 |
|
| 21 |
return ( |
| 22 |
<div |
| 23 |
data-active={isActive} |
| 24 |
data-path={targetPath} |
| 25 |
className={"tableberg-menu-navigation-header-button"} |
| 26 |
tabIndex={0} |
| 27 |
role={"button"} |
| 28 |
onClick={onClickHandlerDefault} |
| 29 |
onKeyDown={onClickHandlerDefault} |
| 30 |
> |
| 31 |
{title} |
| 32 |
</div> |
| 33 |
); |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* @module NavigationHeaderButton |
| 38 |
*/ |
| 39 |
export default NavigationHeaderButton; |
| 40 |
|