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

interface DownloadCVProps {
	windowSize: number;
}

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

	useEffect(() => {
		if (window.innerWidth > 1200) {
			setButtonClass('btn-lg');
		} else {
			setButtonClass('');
		}
	}, [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 ' + buttonClass}>
					Download my CV
			</a>
		</div>
	);
};
