import { FunctionComponent } from 'react'

import MinimizeButton from '../assets/minimize.png';
import ExitButton from '../assets/exit.png';

const { ipcRenderer } = window.require('electron')

const Titlebar: FunctionComponent = () => {
    const minimize = () => ipcRenderer.send('minimize')
    const quit = () => ipcRenderer.send('close')

    return (
        <header className='absolute top-2 right-8'>
            <button type='button' onClick={minimize} id='minimize' className='pr-2'>
                <img src={MinimizeButton} alt='minimize' />
            </button>
            <button type='button' onClick={quit} id='close'>
                <img src={ExitButton} alt='exit' />
            </button>
        </header>
    )
}
export default Titlebar
