From d5105b5c9f74a4f52e4952b845a37692bb824fd4 Mon Sep 17 00:00:00 2001 From: fragosti Date: Fri, 19 Oct 2018 13:45:12 -0700 Subject: feat: user better syntax for defining ui components --- packages/instant/src/components/ui/container.tsx | 6 +----- packages/instant/src/components/ui/flex.tsx | 2 +- packages/instant/src/components/ui/input.tsx | 6 +----- packages/instant/src/components/ui/text.tsx | 8 +------- 4 files changed, 4 insertions(+), 18 deletions(-) diff --git a/packages/instant/src/components/ui/container.tsx b/packages/instant/src/components/ui/container.tsx index 02b16e39f..b7e17d807 100644 --- a/packages/instant/src/components/ui/container.tsx +++ b/packages/instant/src/components/ui/container.tsx @@ -29,11 +29,7 @@ export interface ContainerProps { zIndex?: number; } -const PlainContainer: React.StatelessComponent = ({ children, className }) => ( -
{children}
-); - -export const Container = styled(PlainContainer)` +export const Container = styled('div')` box-sizing: border-box; ${props => cssRuleIfExists(props, 'display')} ${props => cssRuleIfExists(props, 'position')} diff --git a/packages/instant/src/components/ui/flex.tsx b/packages/instant/src/components/ui/flex.tsx index 327e91926..f2013f60f 100644 --- a/packages/instant/src/components/ui/flex.tsx +++ b/packages/instant/src/components/ui/flex.tsx @@ -17,7 +17,7 @@ const PlainFlex: React.StatelessComponent = ({ children, className })
{children}
); -export const Flex = styled(PlainFlex)` +export const Flex = styled('div')` display: flex; flex-direction: ${props => props.direction}; flex-wrap: ${props => props.flexWrap}; diff --git a/packages/instant/src/components/ui/input.tsx b/packages/instant/src/components/ui/input.tsx index f8c6b6ef6..9db7d1c4c 100644 --- a/packages/instant/src/components/ui/input.tsx +++ b/packages/instant/src/components/ui/input.tsx @@ -12,11 +12,7 @@ export interface InputProps { onChange?: (event: React.ChangeEvent) => void; } -const PlainInput: React.StatelessComponent = ({ value, className, placeholder, onChange }) => ( - -); - -export const Input = styled(PlainInput)` +export const Input = styled('input')` font-size: ${props => props.fontSize}; width: ${props => props.width}; padding: 0.1em 0em; diff --git a/packages/instant/src/components/ui/text.tsx b/packages/instant/src/components/ui/text.tsx index 9fb8ea26f..d23b0034d 100644 --- a/packages/instant/src/components/ui/text.tsx +++ b/packages/instant/src/components/ui/text.tsx @@ -23,14 +23,8 @@ export interface TextProps { display?: string; } -const PlainText: React.StatelessComponent = ({ children, className, onClick }) => ( -
- {children} -
-); - const darkenOnHoverAmount = 0.3; -export const Text = styled(PlainText)` +export const Text = styled('div')` font-family: ${props => props.fontFamily}; font-style: ${props => props.fontStyle}; font-weight: ${props => props.fontWeight}; -- cgit