refactor: remove checkbox

This commit is contained in:
thecodrr
2020-04-05 11:54:53 +05:00
parent f896ac252d
commit 37cd0ce2fa

View File

@@ -1,35 +0,0 @@
import React, { useState, useEffect } from "react";
import { Flex, Text } from "rebass";
import { Switch } from "@rebass/forms";
function CheckBox(props) {
const [checked, setChecked] = useState(props.checked || false);
useEffect(() => {
setChecked(props.checked);
}, [props.checked]);
return (
<Flex
onClick={() => {
if (props.onChecked) {
props.onChecked(!checked);
setChecked(!checked);
}
if (props.onClick) {
props.onClick();
}
}}
width="full"
alignItems="center"
justifyContent="space-between"
sx={{ cursor: "pointer", marginBottom: 2 }}
>
<Flex fontSize="body" sx={{ cursor: "pointer" }} alignItems="center">
<props.icon size={18} />
<Text sx={{ marginLeft: 1 }}>{props.label}</Text>
</Flex>
<Switch checked={checked} />
</Flex>
);
}
export default CheckBox;