import React, { FC } from 'react'
import { GiphyGif } from '../../../types'

interface Props {
    gif: GiphyGif
    selected: boolean
    onSelect: (id: string) => void
}

const Gif: FC<Props> = ({ gif, selected, onSelect }) => {
    return (
        <div className="gif" style={{ borderColor: selected ? '#f00' : '#333' }} onClick={() => onSelect(gif.id)}>
            <img src={gif.images.fixed_height.url} alt={gif.title} />
        </div>
    )
}

export default Gif
