UNPKG

@selfcommunity/react-ui

Version:

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

22 lines (21 loc) 1.23 kB
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 OngoingEventsFilter(inProps) { // PROPS const props = useThemeProps({ props: inProps, name: PREFIX }); const { autoHide = false, showOngoingEvents, handleClick, handleDeleteClick } = props, rest = __rest(props, ["autoHide", "showOngoingEvents", "handleClick", "handleDeleteClick"]); if (autoHide) { return null; } return (_jsx(EventsChipRoot, Object.assign({ color: showOngoingEvents ? 'secondary' : 'default', variant: showOngoingEvents ? 'filled' : 'outlined', label: _jsx(FormattedMessage, { id: "ui.events.filterByOngoingEvents", defaultMessage: "ui.events.filterByOngoingEvents" }), onClick: handleClick, // eslint-disable-next-line @typescript-eslint/ban-ts-ignore // @ts-ignore showOngoingEvents: showOngoingEvents, deleteIcon: showOngoingEvents ? _jsx(Icon, { children: "close" }) : null, onDelete: showOngoingEvents ? handleDeleteClick : undefined }, rest))); }