design-system-govbr-rnp
Version:
## Padrão Digital de Governo - React Biblioteca de componentes React que implementa o [Padrão Visual digital do governo](https://www.gov.br/ds/). O objetivo da biblioteca é facilitar a implementação e promover a padronização das interfaces de sistemas do
77 lines (76 loc) • 2.99 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _classnames = _interopRequireDefault(require("classnames"));
var _styles = require("./styles");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var SignIn = function SignIn(_ref) {
var altText = _ref.altText,
block = _ref.block,
circle = _ref.circle,
density = _ref.density,
variant = _ref.variant,
iconProps = _ref.iconProps,
imgProps = _ref.imgProps,
inverted = _ref.inverted,
onClick = _ref.onClick,
title = _ref.title;
var btnClasses = (0, _classnames.default)({
inverted: !!inverted,
block: !!block
});
var renderSignIn = function renderSignIn() {
return /*#__PURE__*/_react.default.createElement(_styles.SignInContainer, {
onClick: onClick,
variant: variant,
type: "button",
className: btnClasses,
density: density
}, (iconProps === null || iconProps === void 0 ? void 0 : iconProps.icon) && /*#__PURE__*/_react.default.createElement(_styles.IconSignIn, {
"aria-label": iconProps === null || iconProps === void 0 ? void 0 : iconProps.ariaLabel,
icon: iconProps === null || iconProps === void 0 ? void 0 : iconProps.icon
}), title, altText && /*#__PURE__*/_react.default.createElement(_styles.AltText, null, altText), (imgProps === null || imgProps === void 0 ? void 0 : imgProps.src) && /*#__PURE__*/_react.default.createElement("img", {
src: imgProps.src,
alt: imgProps === null || imgProps === void 0 ? void 0 : imgProps.alt
}));
};
var renderIconSignIn = function renderIconSignIn() {
return /*#__PURE__*/_react.default.createElement(_styles.SignInIcon, {
onClick: onClick,
variant: variant,
type: "button",
className: btnClasses,
"aria-label": iconProps === null || iconProps === void 0 ? void 0 : iconProps.ariaLabel,
density: density
}, /*#__PURE__*/_react.default.createElement(_styles.IconSignIn, {
"aria-hidden": "true",
circle: true,
icon: iconProps === null || iconProps === void 0 ? void 0 : iconProps.icon
}));
};
return circle ? renderIconSignIn() : renderSignIn();
};
SignIn.propTypes = {
altText: _propTypes.default.string,
block: _propTypes.default.bool,
circle: _propTypes.default.bool,
density: _propTypes.default.string,
variant: _propTypes.default.string.isRequired,
iconProps: _propTypes.default.shape({
icon: _propTypes.default.object,
ariaLabel: _propTypes.default.string
}),
imgProps: _propTypes.default.shape({
src: _propTypes.default.object,
alt: _propTypes.default.string
}),
inverted: _propTypes.default.bool,
onClick: _propTypes.default.func,
title: _propTypes.default.string.isRequired
};
var _default = SignIn;
exports.default = _default;