-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #263 from Propy/dev
dev -> main
- Loading branch information
Showing
24 changed files
with
1,604 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import React from 'react' | ||
|
||
import Button from '@mui/material/Button'; | ||
import CircularProgress from '@mui/material/CircularProgress'; | ||
|
||
interface IActionButton { | ||
id?: string | ||
text: string | ||
size?: 'large' | 'medium' | 'small' | ||
buttonColor?: "primary" | "secondary" | "info" | "inherit" | "success" | "error" | "warning" | ||
textColor?: string | ||
className?: string | ||
component?: "button" | "div" | ||
variant?: "contained" | "text" | "outlined" | ||
disabled?: boolean | ||
onClick?: () => void | ||
showLoadingIcon?: boolean | ||
} | ||
|
||
const getCircularProgressColor = (color: IActionButton["buttonColor"]) => { | ||
if(color === 'primary') { | ||
return '#bdbdbd'; | ||
} | ||
return ""; | ||
} | ||
|
||
const ActionButton = (props: IActionButton) => { | ||
|
||
const { | ||
id, | ||
text, | ||
size = "medium", | ||
buttonColor = 'primary', | ||
textColor, | ||
className = "", | ||
component = "button", | ||
variant = "outlined", | ||
disabled = false, | ||
showLoadingIcon = false, | ||
onClick, | ||
} = props; | ||
|
||
return ( | ||
<Button | ||
component={component} | ||
disabled={disabled} | ||
variant={variant} | ||
className={className} | ||
onClick={() => onClick && onClick()} | ||
size={size} | ||
color={buttonColor} | ||
style={{ | ||
...(textColor && {color: textColor}), | ||
// lineHeight: 1.1 | ||
}} | ||
{...(id && { id })} | ||
> | ||
{showLoadingIcon && | ||
<CircularProgress color="inherit" style={{height: '18px', width: '18px', marginRight: '8px', color: getCircularProgressColor(buttonColor)}} /> | ||
} | ||
<span style={{padding: 0}}>{text}</span> | ||
</Button> | ||
) | ||
} | ||
|
||
export default ActionButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.