import PropTypes from 'prop-types';
import React from 'react';
import { jss } from '../../utils/styles';
import { createStyles } from './styles/Confirmation';

export default class ConfirmationLeadCapture extends React.Component {
    componentWillMount () {
        this.styleSheet = jss.createStyleSheet(createStyles(), { named: false });
        this.styleSheet.attach();
    }

    componentWillUnmount () {
        this.styleSheet.detach();
    }

    render () {
        const { location } = this.props;
        const hasLocation = !!location;

        return (
            <div className="cheryl__confirmation cheryl__lead-capture">
                <div>Thank you for your interest {hasLocation && ' in'}</div>
                {hasLocation && <h2 className="title">{location}</h2>}

                <div className="cheryl__agent-follow-up">
                    An agent will be in touch with you shortly with more information.
                </div>
            </div>
        );
    }
}

ConfirmationLeadCapture.propTypes = {
    location: PropTypes.string,
};
