diff --git a/package.json b/package.json index 2716102..cbf98bd 100644 --- a/package.json +++ b/package.json @@ -13,12 +13,14 @@ "require": "./dist/index.js" } }, + "dependencies": { + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, "devDependencies": { "@babel/preset-react": "^7.24.1", "@types/react": "^18.2.0", "@types/react-dom": "^18.2.0", - "react": "^18.2.0", - "react-dom": "^18.2.0", "react-scripts": "^5.0.1", "typescript": "^4.0.0" }, diff --git a/src/components/Alert.tsx b/src/components/Alert.tsx index 71c4fbe..2c22bb2 100644 --- a/src/components/Alert.tsx +++ b/src/components/Alert.tsx @@ -1,6 +1,9 @@ import React from "react"; -import "./style.css"; +import styles from "./style.module.css"; import { AlertModalProps } from "../types"; +import { bindClassNames } from "../utils"; + +const cn = bindClassNames(styles); export function AlertModal({ text, @@ -22,14 +25,14 @@ export function AlertModal({ return (
-
+
{text} -
+
diff --git a/src/components/Confirm.tsx b/src/components/Confirm.tsx index 0d48dd2..8827b0b 100644 --- a/src/components/Confirm.tsx +++ b/src/components/Confirm.tsx @@ -1,6 +1,9 @@ import React from "react"; -import "./style.css"; +import styles from "./style.module.css"; import { ConfirmModalProps } from "../types"; +import { bindClassNames } from "../utils"; + +const cn = bindClassNames(styles); export function ConfirmModal({ text, @@ -24,14 +27,14 @@ export function ConfirmModal({ return (
-
+
{text} -
+
+ */ +export const bindClassNames = + (styles: { [key: string]: string }) => + (...classNames: string[]) => { + return classNames.map((className) => styles[className]).join(" "); + };