2017-09-25 16:47:00 +03:00
|
|
|
import styled from 'styled-components';
|
2017-10-09 21:01:34 +03:00
|
|
|
import React from 'react';
|
|
|
|
|
2017-09-25 16:47:00 +03:00
|
|
|
import typography from '../typography';
|
2017-05-18 21:21:33 +03:00
|
|
|
import BaseInput from './base/input';
|
|
|
|
import BaseToggle from './base/toggle';
|
|
|
|
import Baseline from '../baseline';
|
|
|
|
|
2017-09-25 16:47:00 +03:00
|
|
|
const Li = styled.li`
|
|
|
|
list-style-type: none;
|
2017-10-09 16:35:52 +03:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2017-09-25 16:47:00 +03:00
|
|
|
${typography.fontFamily};
|
|
|
|
${typography.normal};
|
2017-10-09 16:35:52 +03:00
|
|
|
|
|
|
|
label {
|
|
|
|
font-weight: 400;
|
|
|
|
}
|
2017-09-25 16:47:00 +03:00
|
|
|
`;
|
|
|
|
|
|
|
|
const Ul = styled.ul`
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
`;
|
|
|
|
|
2017-10-13 22:59:13 +03:00
|
|
|
const CheckboxItem = BaseInput(({ children }) => <Li>{children}</Li>);
|
2017-09-25 16:47:00 +03:00
|
|
|
|
2017-05-18 21:21:33 +03:00
|
|
|
const Checkbox = Baseline(
|
|
|
|
BaseInput(
|
|
|
|
BaseToggle({
|
2017-09-25 16:47:00 +03:00
|
|
|
container: CheckboxItem,
|
2017-05-18 21:21:33 +03:00
|
|
|
type: 'checkbox'
|
|
|
|
})
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @example ./usage-checkbox.md
|
|
|
|
*/
|
2017-08-28 22:21:08 +03:00
|
|
|
export default ({ children, ...rest }) => (
|
|
|
|
<Checkbox {...rest}>{children}</Checkbox>
|
|
|
|
);
|
2017-09-25 16:47:00 +03:00
|
|
|
|
|
|
|
export const CheckboxList = Baseline(Ul);
|