From d20ecc37ce4d728ee97af372825be4b43b6e23dd Mon Sep 17 00:00:00 2001 From: Gimnath-Perera Date: Sun, 3 Sep 2023 13:44:50 +0530 Subject: [PATCH] feat: refactored row numbers --- app/page.tsx | 6 +++--- components/header/index.tsx | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index 26a7741..418d339 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -17,14 +17,14 @@ interface Person { const Home: FC = () => { const [code, setCode] = useState(DEFAULT_INTERFACE); - const [selectedKeys, setSelectedKeys] = useState(new Set(['10'])); + const [numberOfRows, setNumberOfRows] = useState(new Set(['10'])); const handleOnGenerate = (): void => { console.log('*********', code); }; const handleOnRowCountChange = (newRowCount: any): void => { - setSelectedKeys(newRowCount); + setNumberOfRows(newRowCount); }; const handleOnCodeChange = (newCode: string): void => { setCode(newCode); @@ -34,7 +34,7 @@ const Home: FC = () => {
diff --git a/components/header/index.tsx b/components/header/index.tsx index 96279e7..89e7862 100644 --- a/components/header/index.tsx +++ b/components/header/index.tsx @@ -11,13 +11,13 @@ import { type Props = { onGenerate: () => void; onRowCountChange: (rowCount: Selection) => void; - selectedKeys: any; + numberOfRows: any; }; -const Header: FC = ({ onGenerate, onRowCountChange, selectedKeys }) => { +const Header: FC = ({ onGenerate, onRowCountChange, numberOfRows }) => { const selectedValue = React.useMemo( - () => Array.from(selectedKeys).join(', ').replaceAll('_', ' '), - [selectedKeys], + () => Array.from(numberOfRows).join(', ').replaceAll('_', ' '), + [numberOfRows], ); return ( @@ -37,7 +37,7 @@ const Header: FC = ({ onGenerate, onRowCountChange, selectedKeys }) => { variant='flat' disallowEmptySelection selectionMode='single' - selectedKeys={selectedKeys} + selectedKeys={numberOfRows} onSelectionChange={onRowCountChange} > 10