You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
622 B
React
27 lines
622 B
React
4 years ago
|
"use strict";
|
||
|
|
||
|
const React = require("react");
|
||
|
|
||
|
const defaultStyle = require("./style.css");
|
||
|
const useTheme = require("../../util/themeable");
|
||
|
const Icon = require("../icon");
|
||
|
|
||
|
module.exports = function Button({ type, onClick, label, icon }) {
|
||
|
// TODO: Validate type?
|
||
|
// TODO: Content override instead of label/icon?
|
||
|
let { withTheme } = useTheme({ control: "button", defaultStyle });
|
||
|
|
||
|
return (
|
||
|
<button className={withTheme("button", `style-${type}`)} onClick={onClick}>
|
||
|
<span className="buttonContents">
|
||
|
{(icon != null)
|
||
|
? <Icon icon={icon} />
|
||
|
: null
|
||
|
}
|
||
|
|
||
|
{label}
|
||
|
</span>
|
||
|
</button>
|
||
|
);
|
||
|
};
|