InputWithLabel.tsx 612 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import React, { FunctionComponent } from "react"
import Label from "../label/Label"
import styled from "styled-components"
import { distance } from "../../style/sizes"

interface InputWithLabelProps {
    label: string
    bold?: boolean
}

export const InputWithLabel: FunctionComponent<InputWithLabelProps> = props =>
    <StyledInputWithLabel>
        {props.bold ? <Label><b>{props.label}</b></Label> : <Label>{props.label}</Label>}
        {props.children}
    </StyledInputWithLabel>

const StyledInputWithLabel = styled.div`
  display: flex;
  flex-direction: column;
  margin-right: ${distance.medium};
`