diff --git a/src/Radio.js b/src/Radio.js new file mode 100644 index 0000000..490787b --- /dev/null +++ b/src/Radio.js @@ -0,0 +1,39 @@ +import React, {forwardRef} from "react"; +import styled, { css } from "styled-components"; +import { space, layout, compose } from "styled-system"; +import PropTypes from "prop-types"; + +const systemProps = compose(layout, space); + +const radioTheme = css` + appearance: radio; + cursor: pointer; + border-radius: 50%; + margin: 3px 3px 0px 5px; + padding: initial; + border: initial; + + ${systemProps} +`; + +const RadioElement = styled.input` + ${radioTheme} +`; + +const Radio = forwardRef((props, ref) => { + return ; +}); + +Radio.defaultProps = { + as: "input", + type: "radio", + onChange: () => {}, +}; + +Radio.propTypes = { + onChange: PropTypes.func, +} + +Radio.displayName = "Radio"; + +export default Radio; diff --git a/stories/Radio.stories.js b/stories/Radio.stories.js new file mode 100644 index 0000000..b093817 --- /dev/null +++ b/stories/Radio.stories.js @@ -0,0 +1,38 @@ +import React from "react"; +import Radio from "../src/Radio"; +import Label from "../src/Label"; + +export default { title: "Radio"}; + +export const defaultRadio = () => ( +
+ + +
+); +defaultRadio.story = { + name: "Default Radio Btn" +}; + +export const customRadio = () => ( +
+ + +
+); +customRadio.story = { + name: "Custom Radio Btn" +}; + +export const disabledRadio = () => ( +
+ + +
+); +disabledRadio.story = { + name: "Disabled Radio Btn" +};