This repository has been archived on 2022-10-07. You can view files and clone it, but cannot push or open issues or pull requests.
skynet-webportal/packages/webapp/src/components/Button/Button.js

29 lines
659 B
JavaScript
Raw Normal View History

2020-02-13 22:07:42 +00:00
import React from "react";
import classNames from "classnames";
2020-02-12 17:23:10 +00:00
2020-02-13 22:07:42 +00:00
import "./Button.scss";
2020-02-12 17:23:10 +00:00
2020-02-18 16:25:03 +00:00
export default function Button({ href, type, children, full, className, iconLeft, iconRight, ...rest }) {
const classes = classNames("button", { iconLeft, iconRight, full }, className);
2020-02-12 17:23:10 +00:00
if (href) {
return (
<a href={href} className={classes} {...rest}>
{children}
</a>
2020-02-13 22:07:42 +00:00
);
2020-02-12 17:23:10 +00:00
} else if (type) {
return (
<button type={type} className={classes} {...rest}>
{children}
</button>
2020-02-13 22:07:42 +00:00
);
2020-02-12 17:23:10 +00:00
} else {
return (
<button type="button" className={classes} {...rest}>
{children}
</button>
2020-02-13 22:07:42 +00:00
);
2020-02-12 17:23:10 +00:00
}
}