mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 06:28:51 +00:00
Add status button | Revert white icons
This commit is contained in:
7 files changed
+109
-44
No files matched your search
@@ -0,0 +1,57 @@
|
||||
import { Button, ButtonProps, fade, makeStyles } from '@material-ui/core';
|
||||
import React from 'react';
|
||||
|
||||
type StatusButtonStyleColor = 'success' | 'error' | 'warning' | 'info';
|
||||
|
||||
interface IStatusButtonStyleProps {
|
||||
color: StatusButtonStyleColor;
|
||||
}
|
||||
|
||||
const useStyles = makeStyles(
|
||||
(theme) => ({
|
||||
root: {
|
||||
color: ({ color }: IStatusButtonStyleProps) => theme.palette[color].main,
|
||||
'&:hover': {
|
||||
backgroundColor: ({ color }: IStatusButtonStyleProps) =>
|
||||
fade(theme.palette[color].light, theme.palette.action.hoverOpacity),
|
||||
},
|
||||
},
|
||||
outlined: {
|
||||
border: ({ color }: IStatusButtonStyleProps) =>
|
||||
`1px solid ${fade(theme.palette[color].main, 0.5)}`,
|
||||
'&:hover': {
|
||||
border: ({ color }: IStatusButtonStyleProps) =>
|
||||
`1px solid ${theme.palette[color].main}`,
|
||||
},
|
||||
'&$disabled': {
|
||||
border: `1px solid ${theme.palette.action.disabled}`,
|
||||
},
|
||||
},
|
||||
contained: {
|
||||
color: ({ color }: IStatusButtonStyleProps) =>
|
||||
theme.palette[color].contrastText,
|
||||
backgroundColor: ({ color }: IStatusButtonStyleProps) =>
|
||||
theme.palette[color].main,
|
||||
'&:hover': {
|
||||
backgroundColor: ({ color }: IStatusButtonStyleProps) =>
|
||||
theme.palette[color].dark,
|
||||
},
|
||||
},
|
||||
}),
|
||||
{ name: 'MuiButton' }
|
||||
);
|
||||
|
||||
export const StatusButton = ({
|
||||
color = 'info',
|
||||
variant,
|
||||
className,
|
||||
...props
|
||||
}: Omit<ButtonProps, 'color'> & { color: StatusButtonStyleColor }) => {
|
||||
const classes = useStyles({ color });
|
||||
return (
|
||||
<Button
|
||||
className={`${classes.root} ${classes[variant] || ''} ${className}`}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
};
|
||||
Reference in new issue
Block a user