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.
28 lines • 1.24 kB
JavaScript
import { __assign, __rest } from "tslib";
import React from 'react';
import { IconButton as MuiIconButton } from '@mui/material';
import { palette } from '../helpers';
import { styled } from '@mui/material/styles';
var colorMap = {
inherit: palette.inherit,
primary: palette.primary,
secondary: palette.secondary,
error: palette.error,
warning: palette.warning,
info: palette.info,
success: palette.success,
};
var IconButtonStyled = styled(MuiIconButton)(function (_a) {
var circle = _a.circle, color = _a.color, variant = _a.variant, cursor = _a.cursor;
return ({
borderRadius: circle === 'true' ? 99 : 5,
border: variant === 'outlined' ? "1px solid ".concat(colorMap[color]) : 'none',
backgroundColor: variant === 'contained' ? "".concat(colorMap[color]) : 'none',
cursor: cursor,
});
});
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