on e2a43bb help sign in
38 lines 927 B 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} />
24 <svg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'>
25 <path d='M2 3.55661V0H0V5.55661H12.4182V3.55661H2Z' transform='translate(3.84906 11.3371) rotate(-45)' fill='white'/>
26 </svg>
28 </label>
29 <div>
30 <p onChange={onChange} checked={state}>{title}</p>
31 { subtitle === '' ? null : <p>{subtitle}</p> }
32 </div>
33 </div>
34 )
38export default CheckBox