11import noop = require( 'lodash/noop' ) ;
22import * as React from 'react' ;
33
4- import { Box } from './Box' ;
4+ import { Box , IBoxProps } from './Box' ;
55import { Flex } from './Flex' ;
66import { Icon } from './Icon' ;
77import { styled } from './utils' ;
@@ -14,10 +14,12 @@ export interface ICheckboxProps {
1414 width ?: string ;
1515 height ?: string ;
1616 onChange ?: ( checked : boolean ) => void ;
17+
18+ attributes ?: IBoxProps ;
1719}
1820
1921export const BasicCheckbox = ( props : ICheckboxProps ) => {
20- const { id, className, width, height, disabled, onChange = noop } = props ;
22+ const { id, className, width, height, disabled, onChange = noop , attributes } = props ;
2123
2224 const [ checked , setValue ] = React . useState ( props . checked || false ) ;
2325 const isChecked = props . hasOwnProperty ( 'checked' ) ? props . checked : checked ;
@@ -44,7 +46,7 @@ export const BasicCheckbox = (props: ICheckboxProps) => {
4446 radius = "@md"
4547 items = "center"
4648 justify = "center"
47- bg = { isChecked ? '@toggle .checked.bg' : '@toggle .bg' }
49+ bg = { isChecked ? '@checkbox .checked.bg' : '@checkbox .bg' }
4850 cursor = { disabled ? 'not-allowed' : 'pointer' }
4951 width = { width || '20px' }
5052 height = { height || '20px' }
@@ -53,8 +55,9 @@ export const BasicCheckbox = (props: ICheckboxProps) => {
5355 fontSize : '14px' ,
5456 transition : 'background-color .15s ease-in-out' ,
5557 } }
58+ { ...attributes }
5659 >
57- { isChecked && < Icon icon = "check" fg = "@toggle .checked.fg" /> }
60+ { isChecked && < Icon icon = "check" fg = "@checkbox .checked.fg" /> }
5861 </ Flex >
5962 </ Box >
6063 ) ;
0 commit comments