diff --git a/apps/cs/package.json b/apps/cs/package.json index 65039d1b3..742526fb5 100644 --- a/apps/cs/package.json +++ b/apps/cs/package.json @@ -12,7 +12,8 @@ "@common/assets": "workspace:*", "@common/components": "workspace:*", "@tanstack/react-table": "^8.21.2", - "next": "15.1.7" + "next": "15.1.7", + "tailwindcss-animate": "^1.0.7" }, "devDependencies": { "@eslint/eslintrc": "^3", diff --git a/apps/cs/src/pages/site/ui/ip-management-dialog.tsx b/apps/cs/src/pages/site/ui/ip-management-dialog.tsx new file mode 100644 index 000000000..04b71afc7 --- /dev/null +++ b/apps/cs/src/pages/site/ui/ip-management-dialog.tsx @@ -0,0 +1,164 @@ +"use client"; + +import { useState } from "react"; +import { + Dialog, + DialogTrigger, + Button, + DialogContent, + DialogHeader, + DialogTitle, + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, + Input, + RadioGroup, + RadioGroupItem, + Checkbox, +} from "@common/components"; + +type IP = { + id: number; + ipAddress: string; + allowed: boolean; +}; + +function IPManagementDialog() { + const [rows, setRows] = useState([]); + const [rowSelection, setRowSelection] = useState([]); + + const handleSave = () => {}; + + const handleAddIP = () => { + const newIP: IP = { + id: Date.now(), + ipAddress: "", + allowed: true, + }; + setRows([...rows, newIP]); + }; + + const handleDeleteIP = () => { + const filteredRows = rows.filter((row) => !rowSelection.includes(row.id)); + setRows(filteredRows); + setRowSelection([]); + }; + + const handleIPAddressChange = (id: number, value: string) => { + setRows( + rows.map((row) => (row.id === id ? { ...row, ipAddress: value } : row)), + ); + }; + + const handleAllowedChange = (id: number, value: boolean) => { + setRows( + rows.map((row) => (row.id === id ? { ...row, allowed: value } : row)), + ); + }; + + const toggleRowSelection = (id: number) => { + setRowSelection((prev) => { + if (prev.includes(id)) { + return prev.filter((item) => item !== id); + } else { + return [...prev, id]; + } + }); + }; + + return ( + + + + + + + IP 관리 + +
+ + + + +
+
+ + + + + + + + + + NO + 선택 + IP 주소 + 허용여부 + + + + {rows.map((row, idx) => ( + + {idx + 1} + + toggleRowSelection(row.id)} + className="cursor-pointer" + /> + + + + handleIPAddressChange(row.id, e.target.value) + } + className="!text-[1.3rem]" + /> + + + + handleAllowedChange(row.id, value === "true") + } + className="flex justify-center" + > +
+ + +
+
+ + +
+
+
+
+ ))} +
+
+
+
+
+ ); +} + +export { IPManagementDialog }; diff --git a/apps/cs/src/pages/site/ui/register-page.tsx b/apps/cs/src/pages/site/ui/register-page.tsx index 3ab09b7dd..40a098da7 100644 --- a/apps/cs/src/pages/site/ui/register-page.tsx +++ b/apps/cs/src/pages/site/ui/register-page.tsx @@ -15,7 +15,7 @@ import { TableRow, } from "@common/components"; import { SitePageLayout } from "./layout"; - +import { IPManagementDialog } from "./ip-management-dialog"; function RegisterPage() { return ( @@ -57,7 +57,7 @@ function RegisterPage() { - + diff --git a/apps/cs/src/pages/site/ui/site-page.tsx b/apps/cs/src/pages/site/ui/site-page.tsx index 54469c42a..171a7cf07 100644 --- a/apps/cs/src/pages/site/ui/site-page.tsx +++ b/apps/cs/src/pages/site/ui/site-page.tsx @@ -3,12 +3,18 @@ import "@common/assets/styles/grid.css"; import { useRouter } from "next/navigation"; +import { getCoreRowModel, useReactTable } from "@tanstack/react-table"; import { Button, Input, DataTable } from "@common/components"; import { data, columns } from "../model/__mocks__"; import { SitePageLayout } from "./layout"; function SitePage() { const router = useRouter(); + const table = useReactTable({ + data, + columns, + getCoreRowModel: getCoreRowModel(), + }); return ( @@ -28,7 +34,7 @@ function SitePage() {
- +
diff --git a/apps/cs/tailwind.config.ts b/apps/cs/tailwind.config.ts index 3383e603d..19ab5b282 100644 --- a/apps/cs/tailwind.config.ts +++ b/apps/cs/tailwind.config.ts @@ -1,4 +1,5 @@ import type { Config } from "tailwindcss"; +import tailwindcssAnimate from "tailwindcss-animate"; import presetConfig from "../../tailwind.config.preset"; export default { @@ -15,4 +16,5 @@ export default { }, }, }, + plugins: [tailwindcssAnimate], } satisfies Config; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b5c4b7f84..b2fd8e2fb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -45,6 +45,9 @@ importers: next: specifier: 15.1.7 version: 15.1.7(react-dom@18.3.1)(react@18.3.1) + tailwindcss-animate: + specifier: ^1.0.7 + version: 1.0.7(tailwindcss@3.4.17) devDependencies: '@eslint/eslintrc': specifier: ^3