/**
 * Help popover label
 *
 * @author Sergey Shishigin
 * @date 2021-08-06
 */
import * as React from 'react';
import * as styles from './helpPopoverLabel.m.scss';
import {SIZE} from '../../constants';
import {HelpPopover} from '..';

interface IProps {
    text: React.ReactNode;
}

export class HelpPopoverLabel extends React.Component<IProps> {
    override render () {
        const {text, children} = this.props;

        return (
            <>
                <div className={Boolean(children) ? styles.text : ''}>
                    {text}
                    {children && (
                        <HelpPopover
                            iconSize={SIZE.MIDDLE}>
                            {children}
                        </HelpPopover>
                    )}
                </div>

            </>
        );
    }
}
