UNPKG

@selfcommunity/react-ui

Version:

React UI Components to integrate a Community created with SelfCommunity Platform.

54 lines (49 loc) 2.4 kB
import { __rest } from "tslib"; import { jsx as _jsx } from "react/jsx-runtime"; import { styled } from '@mui/material/styles'; import { useThemeProps } from '@mui/system'; import classNames from 'classnames'; import { FormattedMessage } from 'react-intl'; import BaseDialog from '../../shared/BaseDialog'; import { PREFIX } from './constants'; import EventForm from '../EventForm'; import { useCallback } from 'react'; const classes = { root: `${PREFIX}-root` }; const Root = styled(BaseDialog, { name: PREFIX, slot: 'Root' })(() => ({})); /** *> API documentation for the Community-JS EventFormDialog component. Learn about the available props and the CSS API. * #### Import ```jsx import {EventFormDialog} from '@selfcommunity/react-ui'; ``` #### Component Name The name `SCEventFormDialog` can be used when providing style overrides in the theme. #### CSS |Rule Name|Global class|Description| |---|---|---| |root|.SCEventFormDialog-root|Styles applied to the root element.| * @param inProps */ export default function EventFormDialog(inProps) { //PROPS const props = useThemeProps({ props: inProps, name: PREFIX }); const { className, open = true, onClose, EventFormComponentProps } = props, rest = __rest(props, ["className", "open", "onClose", "EventFormComponentProps"]); const handleSuccess = useCallback((event) => { var _a; (_a = EventFormComponentProps === null || EventFormComponentProps === void 0 ? void 0 : EventFormComponentProps.onSuccess) === null || _a === void 0 ? void 0 : _a.call(EventFormComponentProps, event); onClose === null || onClose === void 0 ? void 0 : onClose(); }, [onClose, EventFormComponentProps]); /** * Renders root object */ return (_jsx(Root, Object.assign({ DialogContentProps: { dividers: false }, title: (EventFormComponentProps === null || EventFormComponentProps === void 0 ? void 0 : EventFormComponentProps.event) ? (_jsx(FormattedMessage, { id: "ui.eventForm.title.edit", defaultMessage: "ui.eventForm.title.edit" })) : (_jsx(FormattedMessage, { id: "ui.eventForm.title", defaultMessage: "ui.eventForm.title" })), open: open, onClose: onClose, className: classNames(classes.root, className) }, rest, { children: _jsx(EventForm, Object.assign({}, (EventFormComponentProps && EventFormComponentProps), { onSuccess: handleSuccess })) }))); }