Commit 10e7ea90 by Sakilesh J

fix the types

parent 7b8d7dc7
...@@ -4,17 +4,18 @@ import styles from './item.module.css' ...@@ -4,17 +4,18 @@ import styles from './item.module.css'
import Input from '@/components/base/input/Input'; import Input from '@/components/base/input/Input';
import closeIcon from '@/public/icons/red-x-10333.svg'; import closeIcon from '@/public/icons/red-x-10333.svg';
import Image from 'next/image'; import Image from 'next/image';
import { TodoListItems } from '@/Types/todoTypes';
interface ItemProps { interface ItemProps {
data: TodoListItems id: number;
task: string;
isCompleted: boolean;
onDelete: (id: number) => void; onDelete: (id: number) => void;
updateTask: (id: number, task: string, isCompleted: boolean) => void; updateTask: (id: number, task: string, isCompleted: boolean) => void;
} }
const Item: React.FC<ItemProps> = ({ onDelete, updateTask, data }) => { const Item: React.FC<ItemProps> = ({ onDelete, updateTask, id, isCompleted, task }) => {
const { id, task, isCompleted } = data;
const [isChecked, setisChecked] = useState(isCompleted); const [isChecked, setisChecked] = useState(isCompleted);
useEffect(() => { useEffect(() => {
......
...@@ -14,11 +14,11 @@ export default meta; ...@@ -14,11 +14,11 @@ export default meta;
type story = StoryObj<typeof meta> type story = StoryObj<typeof meta>
export const Item_: story = { export const Item_: story = {
args: { args: {
data: {
id: 1, id: 1,
isCompleted: true, isCompleted: true,
task: 'Buy groceries' task: 'Buy groceries'
}
}, },
} }
......
...@@ -14,7 +14,7 @@ const ListItem: React.FC<ListItemProps> = ({ data, onDelete, updateTask }) => { ...@@ -14,7 +14,7 @@ const ListItem: React.FC<ListItemProps> = ({ data, onDelete, updateTask }) => {
return ( return (
<Item <Item
key={item.id} key={item.id}
data={item} {...item}
onDelete={onDelete} onDelete={onDelete}
updateTask={updateTask} updateTask={updateTask}
/> />
......
...@@ -12,8 +12,13 @@ ...@@ -12,8 +12,13 @@
}, },
{ {
"task": "sdf", "task": "sdf",
"isCompleted": false, "isCompleted": true,
"id": 7 "id": 7
},
{
"task": "new dev another",
"isCompleted": false,
"id": 8
} }
] ]
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment