@pagopa/mui-italia
Version:
[Material-UI](https://mui.com/core/) theme inspired by [Bootstrap Italia](https://italia.github.io/bootstrap-italia/).
22 lines (21 loc) • 1.84 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Secondary = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const material_1 = require("@mui/material");
const shared_1 = require("../shared");
function Secondary({ model, view, title, message, cta, onClose, closeAriaLabel, titleId, }) {
const showCta = !!cta;
const isHorizontal = view.isHorizontal;
const ctaCommonProps = showCta
? {
id: cta.id,
kind: model.ctaKind,
cta,
ariaLabelledBy: `${titleId} ${cta.id}`,
variant: view.variant,
}
: undefined;
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", justifyContent: "space-between", width: "100%", gap: 2 }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "column", flex: 1, gap: 1, minWidth: 0 }, { children: [(0, jsx_runtime_1.jsx)(shared_1.Title, { id: titleId, text: title, textAlign: model.textAlign, variant: view.variant, fontSizeOverride: view.isHorizontal ? undefined : '18px' }), message && (0, jsx_runtime_1.jsx)(shared_1.Message, { text: message, textAlign: model.textAlign, variant: view.variant }), !isHorizontal && ctaCommonProps && ((0, jsx_runtime_1.jsx)(shared_1.Cta, Object.assign({}, ctaCommonProps, { alignSelf: "flex-start", sx: { mt: 1 } })))] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "column", alignItems: "flex-end", gap: 2, flexShrink: 0 }, { children: [onClose && (0, jsx_runtime_1.jsx)(shared_1.CloseButton, { onClose: onClose, ariaLabel: closeAriaLabel }), isHorizontal && ctaCommonProps && ((0, jsx_runtime_1.jsx)(shared_1.Cta, Object.assign({}, ctaCommonProps, { alignSelf: "flex-end", sx: { mt: 'auto' } })))] }))] })));
}
exports.Secondary = Secondary;