import variables from 'modules/variables'; import React, { useState } from 'react'; import { MdAutoFixHigh, MdOutlineArrowForward, MdExpandMore, MdOutlineOpenInNew } from 'react-icons/md'; export default function Items({ type, items, collections = [], toggleFunction, collectionFunction, onCollection, }) { const getMessage = (text) => variables.language.getMessage(variables.languagecode, text); const [count, setCount] = useState(8); const incrementCount = () => { if (count !== items.length && count <= items.length) { if (count + 8 > items.length) { setCount(count + (items.length - count)); } else { setCount(count + 8); } } }; const collection = collections[Math.floor(Math.random() * collections.length)]; return ( <> {(type === 'all' && !onCollection) || (type === 'collections' && !onCollection) ? ( <>
{collection.display_name} {collection.description}
{collection.news === true ? ( Learn More ) : ( )}
) : null}
{items.slice(0, count).map((item) => (
toggleFunction(item)} key={item.name}> icon
{item.display_name || item.name} {item.author}
))}
{count !== items.length && items.length >= 8 ? ( Show More ) : null} {items.length <= 8 ? ( Showing {items.length} / {items.length} ) : ( Showing {count} / {items.length} )}
{type === 'all' && !onCollection ? (
{getMessage('modals.main.marketplace.cant_find')} {getMessage('modals.main.marketplace.knowledgebase_one')}{' '} {getMessage('modals.main.marketplace.knowledgebase_two')} {' '} {getMessage('modals.main.marketplace.knowledgebase_three')}
) : null} ); }