Skip to content

Instantly share code, notes, and snippets.

@Flow11

Flow11/getItems.tsx Secret

Last active Jun 27, 2020
Embed
What would you like to do?
Zelda BOTW Part 1: getItems
import items from "../data/items";
import {
ItemType,
ItemsMainCategoriesType,
ItemCategoriesType,
} from "../data/items.type";
const emptyItem = {
name: "",
icon: "",
value: "",
description: "",
category: ItemCategoriesType.WEAPON,
};
const getItems = (
category = ItemsMainCategoriesType.WEAPONS,
itemsPerPage = 20
): ItemType[] => {
const itemsGrid = items[category].concat(
new Array(itemsPerPage - items[category].length).fill(emptyItem)
);
return itemsGrid;
};
export default getItems;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment