import React from "react";
import { Icon } from "component/common.js";
const Link = props => {
const {
href,
title,
style,
label,
icon,
badge,
button,
disabled,
children,
navigate,
doNavigate,
} = props;
const className =
(props.className || "") +
(!props.className && !button ? "button-text" : "") + // Non-button links get the same look as text buttons
(button ? " button-block button-" + button + " button-set-item" : "") +
(disabled ? " disabled" : "");
const onClick = !props.onClick && navigate
? () => {
doNavigate(navigate);
}
: props.onClick;
let content;
if (children) {
content = children;
} else {
content = (
{"icon" in props ? : null}
{label ? {label} : null}
{"badge" in props ? {badge} : null}
);
}
return (
{content}
);
};
export default Link;