mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
34 lines
671 B
TypeScript
34 lines
671 B
TypeScript
import { FC } from 'react';
|
|
|
|
import classNames from 'classnames';
|
|
|
|
import styles from './styles.module.scss';
|
|
|
|
interface InputWrapperProps {
|
|
title?: string;
|
|
error?: string;
|
|
focused: boolean;
|
|
notEmpty: boolean;
|
|
}
|
|
|
|
const InputWrapper: FC<InputWrapperProps> = ({
|
|
children,
|
|
notEmpty,
|
|
title,
|
|
focused,
|
|
error,
|
|
}) => (
|
|
<div
|
|
className={classNames(styles.content, {
|
|
[styles.has_error]: !!error,
|
|
[styles.focused]: focused,
|
|
[styles.not_empty]: notEmpty,
|
|
})}
|
|
>
|
|
{!!title && <div className={styles.title}>{title}</div>}
|
|
{children}
|
|
{!!error && <div className={styles.error}>{error}</div>}
|
|
</div>
|
|
);
|
|
|
|
export { InputWrapper };
|