import React from "react"; import { Album } from "../interfaces"; export default (props: Props) => { const handleKeyPress = (e: KeyboardEvent, callback: Function) => { const SPACE_KEY = 32; const ENTER_KEY = 13; if (e.charCode === SPACE_KEY || e.charCode === ENTER_KEY) { e.preventDefault(); callback(); } }; const { album, handleOnClick } = props; const { id, artist, title, songs, year, img, purchased_on } = album; const imagePath = `./covers/${img}`; const song = songs.join(", "); return (
handleOnClick(album)} >
cover
#{id + 1}: {artist} - {song}, från "{title}" ({year})
✔️ {purchased_on}
); }; type Props = { key: number; album: Album; handleOnClick: Function; };