Files
object-browser/portal-ui/src/screens/Console/Common/BoxIconButton.tsx
Daniel Valdivia 685cfda752 Update Box Button Style and move Icons to the Right (#1199)
* Update Box Button Style and move Icons to the Right

Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>

* Add AButton component to replace <a> tags

Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2021-11-08 16:09:59 -08:00

88 lines
2.4 KiB
TypeScript

// This file is part of MinIO Console Server
// Copyright (c) 2021 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import React from "react";
import { Theme } from "@mui/material/styles";
import createStyles from "@mui/styles/createStyles";
import withStyles from "@mui/styles/withStyles";
import { IconButton, IconButtonProps } from "@mui/material";
import clsx from "clsx";
const styles = (theme: Theme) =>
createStyles({
root: {
padding: 8,
marginLeft: 8,
borderWidth: 1,
borderColor: "#696969",
color: "#696969",
borderStyle: "solid",
borderRadius: 3,
"& .MuiSvgIcon-root": {
fontSize: 20,
},
"& .MuiTouchRipple-root span": {
backgroundColor: theme.palette.primary.main,
borderRadius: 3,
opacity: 0.3,
},
"&:disabled": {
color: "#EBEBEB",
borderColor: "#EBEBEB",
},
},
contained: {
borderColor: theme.palette.primary.main,
background: theme.palette.primary.main,
color: "white",
"& .MuiTouchRipple-root span": {
backgroundColor: theme.palette.primary.dark,
borderRadius: 3,
opacity: 0.3,
},
"&:hover": {
backgroundColor: theme.palette.primary.light,
color: "#FFF",
},
},
});
interface IBoxIconButton extends IconButtonProps {
classes: any;
children: any;
variant?: "outlined" | "contained";
}
const BoxIconButton = ({
classes,
children,
variant = "outlined",
...rest
}: IBoxIconButton) => {
return (
<IconButton
{...rest}
className={clsx(classes.root, {
[classes.contained]: variant == "contained",
})}
>
{children}
</IconButton>
);
};
export default withStyles(styles)(BoxIconButton);