2020-07-08 19:36:36 +02:00
|
|
|
import React from "react";
|
|
|
|
import styled from "styled-components";
|
|
|
|
import { App, IAppProps } from "./app";
|
|
|
|
import { ItemList, Item, SubHeadline } from "./elements";
|
|
|
|
|
|
|
|
const CategoryHeadline = styled(SubHeadline)`
|
|
|
|
padding-top: 1rem;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const CategoryContainer = styled.div`
|
|
|
|
width: 100%;
|
|
|
|
`;
|
|
|
|
|
2021-03-05 22:00:32 +01:00
|
|
|
export interface IAppCategoryProps {
|
2020-07-08 19:36:36 +02:00
|
|
|
name: string;
|
|
|
|
items: Array<IAppProps>;
|
|
|
|
}
|
|
|
|
|
2021-03-21 19:59:18 +01:00
|
|
|
/**
|
|
|
|
* Renders one app category
|
|
|
|
* @param {IAppCategoryProps} props - The props of the given category
|
|
|
|
*/
|
2020-07-08 19:36:36 +02:00
|
|
|
export const AppCategory = ({ name, items }: IAppCategoryProps) => (
|
|
|
|
<CategoryContainer>
|
|
|
|
{name && <CategoryHeadline>{name}</CategoryHeadline>}
|
|
|
|
<ItemList>
|
|
|
|
{items.map((app, idx) => (
|
|
|
|
<Item key={[app.name, idx].join("")}>
|
|
|
|
<App
|
|
|
|
name={app.name}
|
|
|
|
icon={app.icon}
|
2021-03-21 20:19:44 +01:00
|
|
|
url={app.url}
|
2020-07-08 19:36:36 +02:00
|
|
|
displayURL={app.displayURL}
|
2021-04-03 16:54:44 +02:00
|
|
|
newTab={app.newTab}
|
2020-07-08 19:36:36 +02:00
|
|
|
/>
|
|
|
|
</Item>
|
|
|
|
))}
|
|
|
|
</ItemList>
|
|
|
|
</CategoryContainer>
|
|
|
|
);
|