UNPKG

react-styled-toggle

Version:
12 lines (11 loc) 1.14 kB
import React from 'react'; import { GlobalContainer, InputContainer, Label, Slider, Input } from './style'; const Toggle = ({ name, value, checked, disabled, labelRight, labelLeft, width = 60, height = 34, translate = 26, sliderWidth = 26, sliderHeight = 26, backgroundColorChecked = '#2193F3', backgroundColorUnchecked = '#ccc', backgroundColorButton = '#fff', onChange, }) => { return (React.createElement(GlobalContainer, null, labelLeft && React.createElement(Label, null, labelLeft), React.createElement(InputContainer, { onChange: onChange, width: width, height: height }, React.createElement(Input, { type: "checkbox", name: name, value: value, checked: checked, disabled: disabled, translate: translate, backgroundColorUnchecked: backgroundColorUnchecked, backgroundColorChecked: backgroundColorChecked }), React.createElement(Slider, { sliderWidth: sliderWidth, sliderHeight: sliderHeight, backgroundColorUnchecked: backgroundColorUnchecked, backgroundColorButton: backgroundColorButton })), labelRight && React.createElement(Label, null, labelRight))); }; export default Toggle;