Changing button

This commit is contained in:
Nerdy Canuck 2021-12-19 15:39:06 -05:00
parent 0092c02523
commit 318a784451
3 changed files with 10 additions and 11 deletions

View File

@ -19,6 +19,7 @@
"author": "The Nerdy Canuck",
"license": "MIT",
"devDependencies": {
"@types/node": "^17.0.1",
"@types/react": "^17.0.37",
"@types/react-dom": "^17.0.11",
"react": "^17.0.2",

View File

@ -3,21 +3,19 @@ import React from 'react';
export interface IButtonProps extends React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> {
backgroundColor?: string;
color?: string;
style?: React.CSSProperties;
}
export const Button: React.FunctionComponent<IButtonProps> = (props) => {
const { children, backgroundColor, style } = props;
const { children, backgroundColor, color, style } = props;
let _style = style;
/** Override Defaults */
if (backgroundColor && _style) _style.backgroundColor = backgroundColor;
if (color && _style) _style.color = color;
return (
<button
style={{
...style,
backgroundColor: backgroundColor || 'black',
color: 'white'
}}
{...props}
>
<button style={_style} {...props}>
{children}
</button>
);

View File

@ -13,7 +13,7 @@
"outDir": "dist/esm",
"sourceMap": true,
"strict": true,
"target": "es5"
"target": "es6"
},
"include": ["src/**/*.ts", "src/**/*.tsx"]
}