tloncorp / indigo-react

React components that implement Tlon's design language
MIT License
40 stars 6 forks source link

feature: styling and construction of inputs #4

Closed nickbytes closed 5 years ago

nickbytes commented 5 years ago

First pass at some of the inputs.

Need to add in icons (dropped a few comments for you in Figma @jyng ), remove 'success' messaging, fine tune styles.

Nice part about styled-components is that you can now use the as prop to create different DOM elements with the same styles. So we don't need a <Textarea/> component that is essentially the same as a <FieldInput/>. Instead, we can do <FieldInput as="textarea" />. We can also reuse things like Span to be labels by doing Span as="label" />.

Should check my example here: https://github.com/urbit/indigo-react/pull/4/files#diff-0712b3b827cab2aafa061d6952e2f384R11 Personally, I wouldn't tightly couple the input elements much more. Use a library like formik (which is now React's official recommendation for form management) to pass in error/touched/submitting/success etc etc.

image

image