2020-08-26 13:32:52 +00:00
|
|
|
import React from 'react';
|
|
|
|
|
2021-02-25 21:51:16 +00:00
|
|
|
export default function Items(props) {
|
|
|
|
if (props.items.length === 0) {
|
2021-03-07 19:06:49 +00:00
|
|
|
return null; // todo: add message here
|
2021-01-16 22:43:46 +00:00
|
|
|
}
|
2020-08-26 13:32:52 +00:00
|
|
|
|
|
|
|
return (
|
2021-03-07 19:06:49 +00:00
|
|
|
<div className='items'>
|
|
|
|
{props.items.map((item) =>
|
|
|
|
<div className='item' onClick={() => props.toggleFunction(item.name)} key={item.name}>
|
|
|
|
<img alt='icon' draggable={false} src={'https://external-content.duckduckgo.com/iu/?u=' + item.icon_url} />
|
|
|
|
<div className='details'>
|
|
|
|
<h4>{item.display_name ? item.display_name : item.name}</h4>
|
|
|
|
<p>{item.author}</p>
|
|
|
|
</div>
|
|
|
|
</div>)}
|
|
|
|
</div>
|
2020-08-26 13:32:52 +00:00
|
|
|
);
|
|
|
|
}
|