import React from 'react';
import { Input } from 'antd';
import styles from './styles.less';
import { InputProps } from '../editInterface';

export default function(props: InputProps) {
    const { value, maxLength, placeholder } = props;
    const inputProps = { value, maxLength, placeholder };

    return (
        <div className={styles.container}>
            <Input className={styles.input} {...inputProps} />
            {maxLength && (
                <span className={styles.wordNumber}>
                    已输入{(value || '').length || 0}/{maxLength}
                </span>
            )}
        </div>
    );
}
