Skip to content

Commit d76c0a6

Browse files
committed
chore: minor refactoring to remove dependency warning
1 parent 5d2a795 commit d76c0a6

File tree

6 files changed

+24
-15
lines changed

6 files changed

+24
-15
lines changed

.changeset/silent-needles-pump.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cube-dev/ui-kit": patch
3+
---
4+
5+
Add new chart icons and update the old ones.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { createContext } from 'react';
2+
3+
import { CubeNotificationsApi, CubeNotifyApiPropsWithID } from '../types';
4+
5+
export const NotificationsContext = createContext<{
6+
api: CubeNotificationsApi;
7+
addOnDismissListener: (
8+
listener: (notification: CubeNotifyApiPropsWithID) => void,
9+
) => () => void;
10+
} | null>(null);

src/components/overlays/NewNotifications/NotificationsContext/NotificationsProvider.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
1-
import { createContext, PropsWithChildren, RefObject, useMemo } from 'react';
1+
import { PropsWithChildren, RefObject, useMemo } from 'react';
22

33
import { Portal } from '../../../portal';
44
import { NotificationsBar } from '../Bar';
5-
import { CubeNotificationsApi, CubeNotifyApiPropsWithID } from '../types';
65

6+
import { NotificationsContext } from './NotificationsContext';
77
import { useNotifications } from './use-notifications';
88

9-
export const NotificationsContext = createContext<{
10-
api: CubeNotificationsApi;
11-
addOnDismissListener: (
12-
listener: (notification: CubeNotifyApiPropsWithID) => void,
13-
) => () => void;
14-
} | null>(null);
15-
169
export function NotificationsProvider(
1710
props: PropsWithChildren<{ rootRef: RefObject<HTMLElement | null> | null }>,
1811
) {
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
export {
2-
NotificationsProvider,
3-
NotificationsContext,
4-
} from './NotificationsProvider';
1+
export { NotificationsProvider } from './NotificationsProvider';
2+
export { NotificationsContext } from './NotificationsContext';

src/components/overlays/NewNotifications/hooks/use-notifications-observer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useContext, useEffect } from 'react';
22

33
import { useEvent } from '../../../../_internal';
4-
import { NotificationsContext } from '../NotificationsContext/NotificationsProvider';
4+
import { NotificationsContext } from '../NotificationsContext';
55
import { CubeNotifyApiPropsWithID } from '../types';
66

77
export function useNotificationsObserver(

src/components/overlays/NewNotifications/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
export { NotificationsProvider } from './NotificationsContext';
1+
export {
2+
NotificationsProvider,
3+
NotificationsContext,
4+
} from './NotificationsContext';
25
export * from './NotificationsList';
36
export * from './hooks';
47
export { NotificationAction } from './NotificationView';

0 commit comments

Comments
 (0)