@selfcommunity/react-ui
Version:
React UI Components to integrate a Community created with SelfCommunity Platform.
22 lines (21 loc) • 1.2 kB
JavaScript
import { __rest } from "tslib";
import { jsx as _jsx } from "react/jsx-runtime";
import { Icon, useThemeProps } from '@mui/material';
import { FormattedMessage } from 'react-intl';
import { PREFIX } from './constants';
import { EventsChipRoot } from './Events';
export default function PastEventsFilter(inProps) {
// PROPS
const props = useThemeProps({
props: inProps,
name: PREFIX
});
const { autoHide = false, showPastEvents, handleClick, handleDeleteClick } = props, rest = __rest(props, ["autoHide", "showPastEvents", "handleClick", "handleDeleteClick"]);
if (autoHide) {
return null;
}
return (_jsx(EventsChipRoot, Object.assign({ color: showPastEvents ? 'secondary' : 'default', variant: showPastEvents ? 'filled' : 'outlined', label: _jsx(FormattedMessage, { id: "ui.events.filterByPastEvents", defaultMessage: "ui.events.filterByPastEvents" }), onClick: handleClick,
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
showPastEvents: showPastEvents, deleteIcon: showPastEvents ? _jsx(Icon, { children: "close" }) : null, onDelete: showPastEvents ? handleDeleteClick : undefined }, rest)));
}