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

import { createStyles } from './styles/AppointmentConfirmed';
import CheckIconSVG from './SVG/CheckIconSVG';

export default class AppointmentConfirmed extends React.Component {
    static propTypes = {
        customColor: PropTypes.string.isRequired,
        email: PropTypes.string.isRequired
    };

    componentWillMount () {
        this.styleSheet = jss.createStyleSheet(createStyles(this.props.customColor), { named: false });
        this.styleSheet.attach();
    }

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

    render () {
        return (
            <div className="cheryl__confirmed">
                <div className="cheryl__icon-wrapper">
                    <CheckIconSVG className="cheryl__icon" />
                </div>

                <h2 className="cheryl__title">Thank You!</h2>

                <p>
                    Your appointment has been successfully scheduled!
                    <br />
                    A confirmation email was sent to {this.props.email}.
                </p>
            </div>
        );
    }
}
