@@ -25,11 +25,11 @@ import { defaultColours } from "../../../colourscheme";
2525
2626export interface ActionButtonProps {
2727 text : string ;
28- disabled ?: boolean ;
28+ enabled ?: boolean ;
2929 onClick : ( event : React . MouseEvent < HTMLButtonElement > ) => void ;
3030 image ?: string ;
31- backgroundColor ?: Color ;
32- foregroundColor ?: Color ;
31+ backgroundColor ?: Color | string ;
32+ foregroundColor ?: Color | string ;
3333 border ?: Border ;
3434 font ?: Font ;
3535 actions ?: WidgetActions ;
@@ -39,21 +39,25 @@ export interface ActionButtonProps {
3939export const ActionButtonComponent = (
4040 props : ActionButtonProps
4141) : JSX . Element => {
42+ const {
43+ enabled = true ,
44+ foregroundColor = defaultColours . palette . primary . contrastText ,
45+ backgroundColor = defaultColours . palette . primary . main
46+ } = props ;
4247 return (
4348 < ThemeProvider theme = { defaultColours } >
4449 < Button
4550 variant = "contained"
46- disabled = { props . disabled }
51+ disabled = { ! enabled }
4752 sx = { {
4853 height : "100%" ,
4954 width : "100%" ,
55+ whiteSpace : "nowrap" ,
56+ overflow : "hidden" ,
57+ textAlign : "left" ,
5058 fontFamily : props . font ?. css ( ) ?? "" ,
51- color :
52- props . foregroundColor ?. toString ( ) ??
53- defaultColours . palette . primary . contrastText ,
54- backgroundColor :
55- props . backgroundColor ?. toString ( ) ??
56- defaultColours . palette . primary . main ,
59+ color : foregroundColor . toString ( ) ,
60+ backgroundColor : backgroundColor . toString ( ) ,
5761 border : props . border ?. css ( ) ?? "" ,
5862 ".Mui-disabled &" : {
5963 pointerEvents : "unset" ,
@@ -88,7 +92,7 @@ const ActionButtonPropType = {
8892 font : FontPropOpt ,
8993 border : BorderPropOpt ,
9094 visible : BoolPropOpt ,
91- disabled : BoolPropOpt ,
95+ enabled : BoolPropOpt ,
9296 onClick : FuncPropOpt
9397} ;
9498
@@ -117,7 +121,7 @@ export const ActionButtonWidget = (
117121 return (
118122 < ActionButtonComponent
119123 text = { props . text ?? "" }
120- disabled = { props . readonly }
124+ enabled = { props . enabled }
121125 onClick = { onClick }
122126 image = { props . image }
123127 backgroundColor = { props . backgroundColor }
0 commit comments