dashboard/src/components/appList.tsx

31 lines
768 B
TypeScript
Raw Normal View History

import React from "react";
import { AppCategory, IAppCategoryProps } from "./appCategory";
import { IAppProps } from "./app";
2020-07-08 19:36:36 +02:00
import { Headline, ListContainer } from "./elements";
2020-07-08 19:36:36 +02:00
export interface IAppListProps {
categories: Array<IAppCategoryProps>;
apps: Array<IAppProps>;
}
2020-07-10 00:17:18 +02:00
const AppList = ({ categories, apps }: IAppListProps) => {
2020-07-08 19:36:36 +02:00
return (
<ListContainer>
<Headline>Applications</Headline>
{categories &&
categories.map(({ name, items }, idx) => (
<AppCategory key={[name, idx].join("")} name={name} items={items} />
))}
{apps && (
<AppCategory
2020-09-08 13:18:58 +02:00
name={categories ? "Uncategorized apps" : ""}
2020-07-08 19:36:36 +02:00
items={apps}
/>
)}
</ListContainer>
);
};
export default AppList;