
import React from 'react';
import { createNamespace } from '../../../../../tools/namingTools';
import { footerNewsletterPropTypes } from '../../../../../constants/components/prop-types/footer';
import { footerNewsLetterDefaultProps } from '../../../../../constants/components/schemas/footer';
import ButtonIcon from '../../../../../atoms/button-icon/ButtonIcon';

import './styles/FooterNewsletter.scss';

const n = createNamespace('FooterNewsletter');

const FooterNewsletter = ({
    url,
    buttonTheme,
    i18n
}) => {
    const { newsletterTitle, newsletterDescription, newsletterButtonLabel } = i18n;

    return (
        <div {...n('wrapper').props}>
            {newsletterTitle && (
                <span {...n('title').props}>{newsletterTitle}</span>
            )}
            {newsletterDescription && (
                <p {...n('description').props}>{newsletterDescription}</p>
            )}
            {newsletterButtonLabel && (
                <div {...n('button').props}>
                    <ButtonIcon
                        url={url}
                        theme={buttonTheme}
                    >
                        {newsletterButtonLabel}
                    </ButtonIcon>
                </div>
            )}
        </div>
    );
};

FooterNewsletter.propTypes = footerNewsletterPropTypes;

FooterNewsletter.defaultProps = footerNewsLetterDefaultProps;

export default FooterNewsletter;
