Skip to content

Commit

Permalink
fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
fkhadra committed Jul 2, 2023
1 parent 62b486f commit 4665865
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 20 deletions.
6 changes: 1 addition & 5 deletions src/addons/use-notification-center/NotificationCenter.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
8 changes: 4 additions & 4 deletions src/addons/use-notification-center/useNotificationCenter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export interface UseNotificationCenter<Data> {
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:
* ```
Expand Down Expand Up @@ -123,7 +123,7 @@ export interface UseNotificationCenter<Data> {
* ```
* 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"} })
* ```
*/
Expand All @@ -144,7 +144,7 @@ export interface UseNotificationCenter<Data> {
update(id: Id, item: Partial<NotificationCenterItem<Data>>): Id | null;

/**
* Retrive one or more notifications
* Retrieve one or more notifications
*
* Usage:
* ```
Expand All @@ -155,7 +155,7 @@ export interface UseNotificationCenter<Data> {
find(id: Id): NotificationCenterItem<Data> | undefined;

/**
* Retrive one or more notifications
* Retrieve one or more notifications
*
* Usage:
* ```
Expand Down
4 changes: 2 additions & 2 deletions src/components/ProgressBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ export interface ProgressBarProps {
hide?: boolean;

/**
* Optionnal className
* Optional className
*/
className?: ToastClassName;

/**
* Optionnal inline style
* Optional inline style
*/
style?: React.CSSProperties;

Expand Down
7 changes: 4 additions & 3 deletions src/core/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions src/core/toast.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -420,7 +420,7 @@ describe('with multi containers', () => {
beforeEach(() => {
cy.mount(<ToastContainer autoClose={false} limit={2} />);
});
it('limit the numder of toast displayed', () => {
it('limit the number of toast displayed', () => {
toast('msg1');
toast('msg2');
toast('msg3');
Expand Down
2 changes: 1 addition & 1 deletion src/core/toast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ function dismiss(params?: Id | RemoveParams) {
removeToast(params);
}
/**
* Remove toast programmaticaly
* Remove toast programmatically
*/
toast.dismiss = dismiss;

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useToast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = `${
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type Nullable<T> = {

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'
Expand Down

0 comments on commit 4665865

Please sign in to comment.