/
githubmirror
/
novu
Обзор
Документация
Войти
/
githubmirror
/
novu
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
next
packages/react/src/components/Bell.tsx
35 строк
938 B
Paweł Tymczuk
feat(js,react,api-service,ws): support severity in inbox components and hooks fixes NV-6470 (#8913)
14 авг 2025, 11:47
Не верифицирован
14 авг 2025, 11:47
7258054
Код
Авторство
О чём код?
import React from 'react'; import { useNovuUI } from '../context/NovuUIContext'; import { useRenderer } from '../context/RendererContext'; import { BellRenderer } from '../utils/types'; import { Mounter } from './Mounter'; import { withRenderer } from './Renderer'; export type BellProps = { renderBell?: BellRenderer; }; const _Bell = React.memo((props: BellProps) => { const { renderBell } = props; const { novuUI } = useNovuUI(); const { mountElement } = useRenderer(); const mount = React.useCallback( (element: HTMLElement) => { return novuUI.mountComponent({ name: 'Bell', element, props: renderBell ? { renderBell: (el, unreadCount) => mountElement(el, renderBell(unreadCount)), } : undefined, }); }, [renderBell, mountElement, novuUI] ); return <Mounter mount={mount} />; }); export const Bell = withRenderer(_Bell);