1f367c641e
- avoid declaring components inside the body function of parent components https://dev.to/borasvm/react-create-component-inside-a-component-456b
35 lines
759 B
JavaScript
35 lines
759 B
JavaScript
// @flow
|
|
import * as React from 'react';
|
|
import { Label } from './common';
|
|
|
|
type InputSimpleProps = {
|
|
name: string,
|
|
type: string,
|
|
label?: any,
|
|
};
|
|
|
|
export const InputSimple = (inputSimpleProps: InputSimpleProps) => {
|
|
const { name, type, label, ...inputProps } = inputSimpleProps;
|
|
|
|
return (
|
|
<>
|
|
<input id={name} type={type} {...inputProps} />
|
|
<Label name={name} label={label} />
|
|
</>
|
|
);
|
|
};
|
|
|
|
type BlockWrapProps = {
|
|
blockWrap: boolean,
|
|
children?: any,
|
|
};
|
|
|
|
export const BlockWrapWrapper = (blockWrapProps: BlockWrapProps) => {
|
|
const { blockWrap, children } = blockWrapProps;
|
|
|
|
return blockWrap ? (
|
|
<fieldset-section class="radio">{children}</fieldset-section>
|
|
) : (
|
|
<span className="radio">{children}</span>
|
|
);
|
|
};
|