From 1a09b6de639e0499d7dc1dc8c90c6848b03a09b8 Mon Sep 17 00:00:00 2001 From: George Lima Date: Thu, 6 Dec 2018 12:42:06 -0300 Subject: [PATCH 1/4] hotfix: components filename case --- app/components/{Layout.js => layout.js} | 0 app/components/{Sidebar.js => sidebar.js} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename app/components/{Layout.js => layout.js} (100%) rename app/components/{Sidebar.js => sidebar.js} (100%) diff --git a/app/components/Layout.js b/app/components/layout.js similarity index 100% rename from app/components/Layout.js rename to app/components/layout.js diff --git a/app/components/Sidebar.js b/app/components/sidebar.js similarity index 100% rename from app/components/Sidebar.js rename to app/components/sidebar.js From 52b0addaa20277edc9932c6add6fef5e66156d2e Mon Sep 17 00:00:00 2001 From: George Lima Date: Thu, 6 Dec 2018 12:42:30 -0300 Subject: [PATCH 2/4] WIP: feature: add input component --- app/components/Input.mdx | 24 +++++++++++++++++++ app/components/input.js | 50 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 app/components/Input.mdx create mode 100644 app/components/input.js diff --git a/app/components/Input.mdx b/app/components/Input.mdx new file mode 100644 index 0000000..81021aa --- /dev/null +++ b/app/components/Input.mdx @@ -0,0 +1,24 @@ +--- +name: Input +--- + +import { Playground, PropsTable } from 'docz' + +import { InputComponent } from './input.js' +import { DoczWrapper } from '../theme.js' + +# Input + + + +## Text Input + + + {() => } + + +## Textarea + + + {() => } + diff --git a/app/components/input.js b/app/components/input.js new file mode 100644 index 0000000..43cb225 --- /dev/null +++ b/app/components/input.js @@ -0,0 +1,50 @@ +// @flow +import React from 'react'; + +import styled from 'styled-components'; + +// TODO: Missing styles + +const defaultStyles = ` + padding: 10px; + width: 100%; +`; + +const Input = styled.input.attrs({ + type: 'text', +})` + ${defaultStyles}; +`; + +const Textarea = styled.textarea` + ${defaultStyles}; +`; + +type Props = { + inputType?: 'input' | 'textarea' | 'dropdown', + value: string, + onChange: string => void, + rows?: number, + disabled?: boolean, + type?: string, +}; + +export const InputComponent = ({ inputType, onChange, ...props }: Props) => { + if (inputType === 'input') { + return onChange(evt.target.value)} {...props} />; + } + + if (inputType === 'textarea') { + return