lbry-desktop/ui/component/common/form-components/input-simple.jsx
Rafael 1f367c641e Cleanup Form-Field
- avoid declaring components inside the body function of parent components https://dev.to/borasvm/react-create-component-inside-a-component-456b
2022-02-08 12:35:40 -05:00

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>
);
};