@selfcommunity/react-ui
Version:
React UI Components to integrate a Community created with SelfCommunity Platform.
38 lines (37 loc) • 1.87 kB
JavaScript
import { __rest } from "tslib";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import React from 'react';
import { Slide, styled } from '@mui/material';
import { useThemeProps } from '@mui/system';
import classNames from 'classnames';
import { useSCPaymentsEnabled } from '@selfcommunity/react-core';
import BaseDialog from '../../shared/BaseDialog';
import { FormattedMessage } from 'react-intl';
const PREFIX = 'SCPaymentProductsDialog';
const classes = {
root: `${PREFIX}-root`
};
const Root = styled(BaseDialog, {
slot: 'Root',
name: PREFIX
})(({ theme }) => ({}));
const Transition = React.forwardRef(function Transition(props, ref) {
return _jsx(Slide, Object.assign({ direction: "up", ref: ref }, props));
});
const NoTransition = React.forwardRef(function NoTransition(props, ref) {
return _jsxs(React.Fragment, { children: [" ", props.children, " "] });
});
export default function PaymentDetailDialog(inProps) {
// PROPS
const props = useThemeProps({
props: inProps,
name: PREFIX
});
const { className, disableInitialTransition = false } = props, rest = __rest(props, ["className", "disableInitialTransition"]);
// HOOKS
const { isPaymentsEnabled } = useSCPaymentsEnabled();
if (!isPaymentsEnabled) {
return null;
}
return (_jsx(Root, Object.assign({ maxWidth: 'sm', fullWidth: true, title: _jsx(FormattedMessage, { id: "ui.paymentDetailDialog.title", defaultMessage: "ui.paymentDetailDialog.title" }), scroll: 'paper', open: true }, (disableInitialTransition ? { TransitionComponent: NoTransition } : { TransitionComponent: Transition }), { className: classNames(classes.root, className), TransitionComponent: Transition }, rest, { children: _jsx(FormattedMessage, { id: "ui.paymentDetailDialog.content", defaultMessage: "ui.paymentDetailDialog.content" }) })));
}