on 6ecd461 help sign in
48 lines 1.1 kB history raw
1import React from 'react';
3const CheckBox = ({
4 name,
5 id,
6 title,
7 subtitle,
8 onChange,
9 className,
10 state,
11}) => {
12 const isCheckedClassname = state === true ? 'isChecked' : 'isNotChecked';
13 return (
14 <div className={`checkbox flex ${isCheckedClassname} ${className}`}>
15 <label>
16 <input
17 name={name}
18 id={id}
19 type={'checkbox'}
20 className={`rc-checkbox-input`}
21 checked={state}
22 onChange={onChange}
23 />
25 <svg
26 width="20"
27 height="20"
28 viewBox="0 0 20 20"
29 fill="none"
30 xmlns="http://www.w3.org/2000/svg">
31 <path
32 d="M2 3.55661V0H0V5.55661H12.4182V3.55661H2Z"
33 transform="translate(3.84906 11.3371) rotate(-45)"
34 fill="white"
35 />
36 </svg>
37 </label>
38 <div>
39 <p onChange={onChange} checked={state}>
40 {title}
41 </p>
42 {subtitle === '' ? null : <p>{subtitle}</p>}
43 </div>
44 </div>
45 );
46};
48export default CheckBox;