added icons to navigation

This commit is contained in:
Florian Scholdei
2018-12-21 13:41:34 +01:00
parent dbf01d6cf3
commit b69c06960e
9 changed files with 27 additions and 9 deletions

View File

@@ -2,16 +2,23 @@
import React from "react";
type Props = {
icon?: string,
label: string,
action: () => void
};
class NavAction extends React.Component<Props> {
render() {
const { label, action } = this.props;
const { label, icon, action } = this.props;
let showIcon = null;
if (icon) {
showIcon = (<><i className={icon}></i>{" "}</>);
}
return (
<li>
<a onClick={action}>{label}</a>
<a onClick={action}>{showIcon}{label}</a>
</li>
);
}