From 4665865097b9f6c81558152a1710bece4b4f97fd Mon Sep 17 00:00:00 2001 From: Fadi Khadra Date: Sun, 2 Jul 2023 19:55:15 +0200 Subject: [PATCH] fix typos --- .../use-notification-center/NotificationCenter.cy.tsx | 6 +----- .../use-notification-center/useNotificationCenter.ts | 8 ++++---- src/components/ProgressBar.tsx | 4 ++-- src/core/store.ts | 7 ++++--- src/core/toast.cy.tsx | 6 +++--- src/core/toast.ts | 2 +- src/hooks/useToast.ts | 2 +- src/types.ts | 2 +- 8 files changed, 17 insertions(+), 20 deletions(-) diff --git a/src/addons/use-notification-center/NotificationCenter.cy.tsx b/src/addons/use-notification-center/NotificationCenter.cy.tsx index 944a69b1..5c76a7c1 100644 --- a/src/addons/use-notification-center/NotificationCenter.cy.tsx +++ b/src/addons/use-notification-center/NotificationCenter.cy.tsx @@ -129,11 +129,7 @@ describe('NotificationCenter', () => { cy.findByText('msg updated').should('exist'); }); - // it('filter', () => { - - // }); - - it('mark as read a single notificaiton', () => { + it('mark as read a single notification', () => { cy.findByTestId('unreadCount').should('contain.text', 0); cy.findByTestId('count').should('contain.text', 0); const id = toast('msg'); diff --git a/src/addons/use-notification-center/useNotificationCenter.ts b/src/addons/use-notification-center/useNotificationCenter.ts index 8efdec0a..0f4e7c65 100644 --- a/src/addons/use-notification-center/useNotificationCenter.ts +++ b/src/addons/use-notification-center/useNotificationCenter.ts @@ -92,7 +92,7 @@ export interface UseNotificationCenter { markAsRead(id: Id | Id[]): void; /** - * Mark one or more notifications as read.The second parameter let you mark the notificaiton as read or not. + * Mark one or more notifications as read.The second parameter let you mark the notification as read or not. * * Usage: * ``` @@ -123,7 +123,7 @@ export interface UseNotificationCenter { * ``` * const id = add({id: "id", content: "test", data: { foo: "hello" } }) * - * // Return the id of the notificaiton, generate one if none provided + * // Return the id of the notification, generate one if none provided * const id = add({ data: {title: "a title", text: "some text"} }) * ``` */ @@ -144,7 +144,7 @@ export interface UseNotificationCenter { update(id: Id, item: Partial>): Id | null; /** - * Retrive one or more notifications + * Retrieve one or more notifications * * Usage: * ``` @@ -155,7 +155,7 @@ export interface UseNotificationCenter { find(id: Id): NotificationCenterItem | undefined; /** - * Retrive one or more notifications + * Retrieve one or more notifications * * Usage: * ``` diff --git a/src/components/ProgressBar.tsx b/src/components/ProgressBar.tsx index ba2b0458..b404eca0 100644 --- a/src/components/ProgressBar.tsx +++ b/src/components/ProgressBar.tsx @@ -36,12 +36,12 @@ export interface ProgressBarProps { hide?: boolean; /** - * Optionnal className + * Optional className */ className?: ToastClassName; /** - * Optionnal inline style + * Optional inline style */ style?: React.CSSProperties; diff --git a/src/core/store.ts b/src/core/store.ts index ef1acfa5..6f4945b0 100644 --- a/src/core/store.ts +++ b/src/core/store.ts @@ -96,13 +96,14 @@ interface ToggleToastParams { containerId?: Id; } -type P = { +type RegisterToggleOpts = { id: Id; containerId?: Id; fn: (v: boolean) => void; }; -export function registerToggle(p: P) { - containers.get(p.containerId || Default.CONTAINER_ID)?.setToggle(p.id, p.fn); + +export function registerToggle(opts: RegisterToggleOpts) { + containers.get(opts.containerId || Default.CONTAINER_ID)?.setToggle(opts.id, opts.fn); } export function toggleToast(v: boolean, opt?: ToggleToastParams) { diff --git a/src/core/toast.cy.tsx b/src/core/toast.cy.tsx index 08e6ff65..f7347c08 100644 --- a/src/core/toast.cy.tsx +++ b/src/core/toast.cy.tsx @@ -84,7 +84,7 @@ describe('with container', () => { }); }); - it('unsubsribe from change event', () => { + it('unsubscribe from change event', () => { const unsub = toast.onChange(cy.stub().as('onChange')); unsub(); toast('msg'); @@ -188,7 +188,7 @@ describe('with container', () => { cy.get('.class3').should('exist'); }); - it('uses syntaxic sugar for different notification type', () => { + it('uses syntactic sugar for different notification type', () => { toast('default'); toast.success('success'); toast.error('error'); @@ -420,7 +420,7 @@ describe('with multi containers', () => { beforeEach(() => { cy.mount(); }); - it('limit the numder of toast displayed', () => { + it('limit the number of toast displayed', () => { toast('msg1'); toast('msg2'); toast('msg3'); diff --git a/src/core/toast.ts b/src/core/toast.ts index 60baf452..901778ae 100644 --- a/src/core/toast.ts +++ b/src/core/toast.ts @@ -189,7 +189,7 @@ function dismiss(params?: Id | RemoveParams) { removeToast(params); } /** - * Remove toast programmaticaly + * Remove toast programmatically */ toast.dismiss = dismiss; diff --git a/src/hooks/useToast.ts b/src/hooks/useToast.ts index b248e74d..1adf50d4 100644 --- a/src/hooks/useToast.ts +++ b/src/hooks/useToast.ts @@ -163,7 +163,7 @@ export function useToast(props: ToastProps) { drag.delta = drag.y - drag.start; } - // prevent false positif during a toast click + // prevent false positive during a toast click if (drag.start !== drag.x) drag.canCloseOnClick = false; toast.style.transform = `translate${props.draggableDirection}(${drag.delta}px)`; toast.style.opacity = `${ diff --git a/src/types.ts b/src/types.ts index 60685844..fe98642c 100644 --- a/src/types.ts +++ b/src/types.ts @@ -7,7 +7,7 @@ type Nullable = { export type TypeOptions = 'info' | 'success' | 'warning' | 'error' | 'default'; -export type Theme = 'light' | 'dark' | 'colored'; +export type Theme = 'light' | 'dark' | 'colored' | (string & {}); export type ToastPosition = | 'top-right'