joyent-portal/packages/ui-toolkit/src/form/radio.js

41 lines
739 B
JavaScript
Raw Normal View History

import styled from 'styled-components';
import BaseToggle from './base/toggle';
import Baseline from '../baseline';
import BaseInput from './base/input';
import typography from '../typography';
import React from 'react';
const Li = styled.li`
list-style-type: none;
${typography.fontFamily};
${typography.normal};
`;
const Ul = styled.ul`
margin: 0;
padding: 0;
`;
2017-06-12 01:58:22 +03:00
const RadioItem = BaseInput(({ children, id, ...rest }) =>
<Li {...rest}>
{children}
</Li>
2017-06-12 01:58:22 +03:00
);
const Radio = Baseline(
BaseToggle({
container: RadioItem,
type: 'radio'
})
);
/**
* @example ./usage-radio.md
*/
2017-06-12 01:58:22 +03:00
export default ({ children, ...rest }) =>
<Radio {...rest}>
{children}
2017-06-12 01:58:22 +03:00
</Radio>;
export const RadioList = Baseline(Ul);