2021-05-11 14:37:15 +00:00
|
|
|
import React from "react"
|
2021-04-21 01:32:19 +00:00
|
|
|
import Style from "./Button.module.css"
|
|
|
|
import classNames from "classnames"
|
2021-04-29 14:58:31 +00:00
|
|
|
import make_icon from "../../utils/make_icon"
|
2021-04-21 01:32:19 +00:00
|
|
|
|
|
|
|
|
2021-04-23 00:18:06 +00:00
|
|
|
/**
|
|
|
|
* A clickable button.
|
|
|
|
*
|
|
|
|
* @param children - The contents of the button.
|
|
|
|
* @param className - Additional class(es) that should be added to the button.
|
|
|
|
* @param color - The color of the button. Either `Red`, `Grey`, `Green` or `Yellow`.
|
|
|
|
* @param icon - The FontAwesome IconDefinition of the icon that should be rendered in the button.
|
|
|
|
* @param props - Additional props to pass to the button.
|
|
|
|
* @returns {JSX.Element}
|
|
|
|
* @constructor
|
|
|
|
*/
|
2021-04-21 01:32:19 +00:00
|
|
|
export default function Button({ children, className, color, icon, ...props }) {
|
|
|
|
return (
|
2021-04-22 17:10:19 +00:00
|
|
|
<button type={"button"} className={classNames(Style.Button, Style[`Button${color}`], className)} {...props}>
|
2021-04-21 01:57:18 +00:00
|
|
|
{children} {make_icon(icon, Style.Icon)}
|
2021-04-21 01:32:19 +00:00
|
|
|
</button>
|
|
|
|
)
|
|
|
|
}
|