import React from 'react';
import classNames from 'classnames';

import '../base';
import styles from './PageFooter.styl';
import Link from './Link';
import { visualProvided } from './VisualProvider';

function PageFooter({ children, t, copyrightYear = false }) {
  const footerClasses = classNames({
    [styles.footer]: true
  });

  return (
    <div className={footerClasses}>
      <div style={{ textAlign: 'left' }}>
        <Link
          external
          target="_blank"
          href={t('privacyPolicyLink', { defaultValue: 'https://www.dormakaba.com/exivo/exivo-for-small-and-medium-enterprises/privacy-policy' })}
        >
          {t('privacyPolicyLabel', { defaultValue: 'Privacy Policy' })}
        </Link>
        <div style={{ float: 'right' }}>
          {children || !copyrightYear ? t('copyrightLabel', { defaultValue: '© dormakaba' }) : (t('copyrightLabel', { defaultValue: '© dormakaba ' + new Date().getFullYear() }) + ' ' + new Date().getFullYear()) }
        </div>
      </div>
    </div>
  );
}

export default visualProvided(PageFooter);
