2018-09-03 16:17:36 +02:00
|
|
|
//@flow
|
|
|
|
|
import React from "react";
|
|
|
|
|
|
|
|
|
|
type Props = {
|
2018-12-21 13:41:34 +01:00
|
|
|
icon?: string,
|
2018-09-03 16:17:36 +02:00
|
|
|
label: string,
|
|
|
|
|
action: () => void
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class NavAction extends React.Component<Props> {
|
|
|
|
|
render() {
|
2018-12-21 13:41:34 +01:00
|
|
|
const { label, icon, action } = this.props;
|
|
|
|
|
|
|
|
|
|
let showIcon = null;
|
|
|
|
|
if (icon) {
|
|
|
|
|
showIcon = (<><i className={icon}></i>{" "}</>);
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-03 16:17:36 +02:00
|
|
|
return (
|
|
|
|
|
<li>
|
2019-01-23 17:52:59 +01:00
|
|
|
<a onClick={action} href="javascript:void(0);">{showIcon}{label}</a>
|
2018-09-03 16:17:36 +02:00
|
|
|
</li>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default NavAction;
|