// @flow
import * as React from 'react';
import Icon from 'src/components/icon';
import { WhiteOutlineButton } from 'src/components/button';
import type { GetUserType } from 'shared/graphql/queries/user/getUser';
import type { GetCommunityType } from 'shared/graphql/queries/community/getCommunity';
import {
StyledLabel,
StyledPrefixLabel,
StyledInput,
StyledTextArea,
StyledUnderlineInput,
StyledHiddenInput,
StyledCheckboxWrapper,
StyledError,
StyledSuccess,
PhotoInputLabel,
CoverInputLabel,
InputOverlay,
CoverImage,
PhotoInputImage,
} from './style';
type InputProps = {
children?: React$Node,
inputType?: string,
defaultValue?: ?string,
value?: ?any,
placeholder?: string,
onChange?: Function,
autoFocus?: boolean,
checked?: boolean,
disabled?: boolean,
id?: string,
dataCy?: string,
user?: GetUserType,
community?: GetCommunityType,
size?: number,
};
export const Input = (props: InputProps) => {
return (
{props.children}
);
};
type PhotoInputProps = {
size?: number,
type: 'user' | 'community',
defaultValue: string,
onChange: Function,
dataCy?: string,
};
export const PhotoInput = (props: PhotoInputProps) => {
const { size = 48, type, defaultValue, onChange, dataCy } = props;
let visible,
src = defaultValue;
if (!src || src.length === 0) {
visible = true;
src =
type === 'user'
? '/img/default_avatar.svg'
: '/img/default_community.svg';
}
return (
);
};
type CoverPhotoInputProps = {
defaultValue: string,
onChange: Function,
dataCy?: string,
};
export const CoverInput = (props: CoverPhotoInputProps) => {
return (
Add Cover Photo
);
};
export const Checkbox = (props: InputProps) => {
return (
{props.checked ? : }
{props.children}
);
};
export const TextArea = (props: InputProps) => {
return (
{props.children}
);
};
export class UnderlineInput extends React.Component {
render() {
return (
{this.props.children}
);
}
}
export const Error = (props: Object) => {
const { children, ...rest } = props;
return {children};
};
export const Success = (props: Object) => {
const { children, ...rest } = props;
return {children};
};