norma-library
Version:
Olos/Norma-DS. Design System based on Material UI, developed with TypeScript and Styled Components to create reusable and consistent components in web applications.
34 lines • 1.58 kB
JavaScript
import { __assign, __rest } from "tslib";
import { IconButton as MuiIconButton } from '@mui/material';
import { styled } from '@mui/material/styles';
import React from 'react';
var IconButtonStyled = styled(MuiIconButton)(function (_a) {
var theme = _a.theme, circle = _a.circle, color = _a.color, variant = _a.variant, cursor = _a.cursor;
var colorMap = {
inherit: theme.palette.text.primary,
primary: theme.palette.primary.main,
secondary: theme.palette.secondary.main,
error: theme.palette.error.main,
warning: theme.palette.warning.main,
info: theme.palette.info.main,
success: theme.palette.success.main,
};
return {
borderRadius: circle === 'true' ? 99 : 5,
border: variant === 'outlined' ? "1px solid ".concat(colorMap[color]) : 'none',
backgroundColor: variant === 'contained' ? "".concat(colorMap[color]) : 'none',
cursor: cursor,
'&:hover': {
backgroundColor: variant === 'contained'
? theme.palette.action.hover
: variant === 'outlined'
? theme.palette.action.hover
: 'none',
},
};
});
export var IconButton = function (_a) {
var _b = _a.circle, circle = _b === void 0 ? false : _b, children = _a.children, props = __rest(_a, ["circle", "children"]);
return (React.createElement(IconButtonStyled, __assign({ circle: "".concat(circle), color: "primary", variant: "text", cursor: "default" }, props), children));
};
//# sourceMappingURL=IconButton.js.map