superdesk/superdesk-client-core

View on GitHub
scripts/apps/contacts/components/Form/Label.tsx

Summary

Maintainability
A
40 mins
Test Coverage
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

export const Label: React.StatelessComponent<any> = ({text, row, light, className}) => (!text ? null : (
    <label
        className={classNames({
            'sd-line-input__label': !row,
            'form-label': row,
            'form-label--light': row && light,
        }, className)}
    >
        {text}
    </label>
));

Label.propTypes = {
    text: PropTypes.string,
    row: PropTypes.bool,
    light: PropTypes.bool,
    className: PropTypes.string,
};

Label.defaultProps = {
    row: false,
    light: false,
};