import React, {useState, useEffect} from 'react';

interface DownloadCVProps {
	windowSize: number;
}

/**
 * @return {jsx} a presentation of me
 */
export default function DownloadCV({windowSize}: DownloadCVProps) {
	const [topClass, setTopClass] = useState('');
	const [bottomClass, setBottomClass] = useState('');

	useEffect(() => {
		if (window.innerWidth > 1200) {
			setTopClass('btn-lg mb-3');
			setBottomClass('btn-lg mt-3');
		} else {
			setTopClass('mb-1');
			setBottomClass('mt-1');
		}
	}, [windowSize]);


	return (
		<div
			className='
				tile-child d-flex
				flex-column
				align-items-center
				justify-content-center'
			id='downloadcv'>
			<a
				href='/static/pdfs/CV_Gaetan_Brochard_2020.pdf'
				download
				rel="noopener noreferrer"
				target="_blank"
				className={'d-inline btn btn-mine ' + topClass}>
					Download my Resume
			</a>
			<a
				/* eslint-disable */
				href='https://www.ouest-france.fr/bretagne/arzal-56190/arzal-gaetan-brochard-propose-une-deambulation-numerique-6949455'
				/* eslint-enable */
				className={'d-inline btn btn-mine ' + bottomClass}>
					Newspaper Article
			</a>
		</div>
	);
};
