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", "author": "The Nerdy Canuck",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@types/node": "^17.0.1",
"@types/react": "^17.0.37", "@types/react": "^17.0.37",
"@types/react-dom": "^17.0.11", "@types/react-dom": "^17.0.11",
"react": "^17.0.2", "react": "^17.0.2",

View File

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

View File

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