Skip to content

Commit

Permalink
style: fix code style by eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
gusrb3164 committed Apr 2, 2022
1 parent 6a68866 commit d2ef68d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 17 deletions.
11 changes: 6 additions & 5 deletions src/AlertContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { CSSProperties, useCallback, useEffect, useState } from 'react';
import Icon from './Icon';
import { AlertDetail } from './type';
import React, { useCallback, useEffect, useState } from "react";
import type { CSSProperties } from "react";
import Icon from "./Icon";
import type { AlertDetail } from "./type";

interface Props {
floatingTime?: number;
Expand All @@ -20,10 +21,10 @@ export const AlertContainer: React.VFC<Props> = ({ floatingTime = 3000, alertSty
}, []);

useEffect(() => {
window.addEventListener('toastAlert', handler as any);
window.addEventListener("toastAlert", handler as any);

return () => {
window.removeEventListener('toastAlert', handler as any);
window.removeEventListener("toastAlert", handler as any);
};
}, []);

Expand Down
10 changes: 5 additions & 5 deletions src/Icon.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react';
import { AlertType } from './type';
import React from "react";
import type { AlertType } from "./type";

const Icon: React.VFC<{ type: AlertType }> = ({ type }) => {
switch (type) {
case 'success':
case "success":
return <Success />;
case 'warning':
case "warning":
return <Warning />;
case 'error':
case "error":
return <Error />;
default:
return <Info />;
Expand Down
6 changes: 3 additions & 3 deletions src/alert.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { AlertDetail } from './type';
import type { AlertDetail } from "./type";

export const alert = (detail: AlertDetail) => {
window.dispatchEvent(
new CustomEvent('toastAlert', {
new CustomEvent("toastAlert", {
detail,
}),
})
);
};
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { AlertContainer } from './AlertContainer';
export { alert } from './alert';
export { AlertType, AlertDetail } from './type';
export { AlertContainer } from "./AlertContainer";
export { alert } from "./alert";
export type { AlertType, AlertDetail } from "./type";
2 changes: 1 addition & 1 deletion src/type.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export type AlertType = 'success' | 'warning' | 'error' | 'info';
export type AlertType = "success" | "warning" | "error" | "info";
export type AlertDetail = { message: string; type: AlertType };

0 comments on commit d2ef68d

Please sign in to comment.