1
1
import noop = require( 'lodash/noop' ) ;
2
2
import * as React from 'react' ;
3
3
4
- import { Box } from './Box' ;
4
+ import { Box , IBoxProps } from './Box' ;
5
5
import { Flex } from './Flex' ;
6
6
import { Icon } from './Icon' ;
7
7
import { styled } from './utils' ;
@@ -14,10 +14,12 @@ export interface ICheckboxProps {
14
14
width ?: string ;
15
15
height ?: string ;
16
16
onChange ?: ( checked : boolean ) => void ;
17
+
18
+ attributes ?: IBoxProps ;
17
19
}
18
20
19
21
export 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 ;
21
23
22
24
const [ checked , setValue ] = React . useState ( props . checked || false ) ;
23
25
const isChecked = props . hasOwnProperty ( 'checked' ) ? props . checked : checked ;
@@ -44,7 +46,7 @@ export const BasicCheckbox = (props: ICheckboxProps) => {
44
46
radius = "@md"
45
47
items = "center"
46
48
justify = "center"
47
- bg = { isChecked ? '@toggle .checked.bg' : '@toggle .bg' }
49
+ bg = { isChecked ? '@checkbox .checked.bg' : '@checkbox .bg' }
48
50
cursor = { disabled ? 'not-allowed' : 'pointer' }
49
51
width = { width || '20px' }
50
52
height = { height || '20px' }
@@ -53,8 +55,9 @@ export const BasicCheckbox = (props: ICheckboxProps) => {
53
55
fontSize : '14px' ,
54
56
transition : 'background-color .15s ease-in-out' ,
55
57
} }
58
+ { ...attributes }
56
59
>
57
- { isChecked && < Icon icon = "check" fg = "@toggle .checked.fg" /> }
60
+ { isChecked && < Icon icon = "check" fg = "@checkbox .checked.fg" /> }
58
61
</ Flex >
59
62
</ Box >
60
63
) ;
0 commit comments