Commit 64719727 by Madhankumar

storybook changes

parent f37d1583
...@@ -11,12 +11,6 @@ ...@@ -11,12 +11,6 @@
"title": "helloxxsxsxsxsxsxsxsxsxsxsxsxsxssssssssssssssssssssxssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss", "title": "helloxxsxsxsxsxsxsxsxsxsxsxsxsxssssssssssssssssssssxssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss",
"isCompleted": false, "isCompleted": false,
"id": 2 "id": 2
},
{
"sId": 1,
"title": "hi",
"isCompleted": true,
"id": 3
} }
] ]
} }
\ No newline at end of file
...@@ -3,7 +3,9 @@ import Checkbox from "."; ...@@ -3,7 +3,9 @@ import Checkbox from ".";
export default { export default {
title: "Base/Checkbox", title: "Base/Checkbox",
component: Checkbox, component: Checkbox,
argTypes: { onChange: { action: "checked" } }, argTypes: {
onChange: { action: "onChange" },
},
}; };
export const checkbox = { export const checkbox = {
isCompleted: false, isCompleted: false,
......
import "./checkbox.css"; import "./checkbox.css";
function Checkbox({ ...props }) { function Checkbox({ isCompleted, onChange, ...props }) {
const handleChange = () => {
isCompleted = !isCompleted;
onChange(isCompleted ? "checked" : "unchecked");
};
return ( return (
<div className="checkbox-bg"> <div className="checkbox-bg">
<input type="checkbox" name="checkbox" {...props} /> <input
type="checkbox"
name="checkbox"
onChange={handleChange}
{...props}
/>
</div> </div>
); );
} }
......
...@@ -3,7 +3,7 @@ import Form from "."; ...@@ -3,7 +3,7 @@ import Form from ".";
export default { export default {
title: "Top-Level/Form", title: "Top-Level/Form",
component: Form, component: Form,
argTypes: { onSubmit: { action: "Submit" } }, argTypes: { onSubmit: { action: "onSubmit" } },
}; };
export const form = {}; export const form = {};
// const Template = (args) => <Form {...args} />; // const Template = (args) => <Form {...args} />;
......
...@@ -17,10 +17,9 @@ function Task({ id, title, isCompleted, onDelete, onChange, onEdit }) { ...@@ -17,10 +17,9 @@ function Task({ id, title, isCompleted, onDelete, onChange, onEdit }) {
} }
return false; return false;
}; };
const handleChange = (e) => { const handleChange = () => {
e.preventDefault();
isCompleted = !isCompleted; isCompleted = !isCompleted;
onChange({ id, isCompleted: isCompleted ? "checked" : "unchecked" }); onChange({ id, isCompleted: isCompleted ? true : false });
}; };
const handleContent = (e) => { const handleContent = (e) => {
......
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