Skip to content

Instantly share code, notes, and snippets.

@g-a-v-i-n
Created September 24, 2018 18:42
Show Gist options
  • Save g-a-v-i-n/331c48385bade64d4baae31b9941db60 to your computer and use it in GitHub Desktop.
Save g-a-v-i-n/331c48385bade64d4baae31b9941db60 to your computer and use it in GitHub Desktop.
const CheckBox = ({
name,
id,
title,
subtitle,
onChange,
className,
state,
}) => {
const isCheckedClassname = state === true ? 'isChecked' : 'isNotChecked'
return (
<div className={`checkbox flex ${isCheckedClassname} ${className}`}>
<label>
<input
name={name}
id={id}
type={'checkbox'}
className={`rc-checkbox-input`}
checked={state}
onChange={onChange} />
<svg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'>
<path d='M2 3.55661V0H0V5.55661H12.4182V3.55661H2Z' transform='translate(3.84906 11.3371) rotate(-45)' fill='white'/>
</svg>
</label>
<div>
<p>{title}</p>
{ subtitle === '' ? null : <p>{subtitle}</p> }
</div>
</div>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment