2021-05-13 17:21:52 +02:00
|
|
|
import classes from './AppGrid.module.css';
|
2021-06-08 14:02:19 +02:00
|
|
|
import { Link } from 'react-router-dom';
|
2021-05-13 17:21:52 +02:00
|
|
|
import { App } from '../../../interfaces/App';
|
|
|
|
|
|
|
|
import AppCard from '../AppCard/AppCard';
|
|
|
|
|
|
|
|
interface ComponentProps {
|
|
|
|
apps: App[];
|
|
|
|
}
|
|
|
|
|
|
|
|
const AppGrid = (props: ComponentProps): JSX.Element => {
|
2021-06-08 14:02:19 +02:00
|
|
|
let apps: JSX.Element;
|
|
|
|
|
|
|
|
if (props.apps.length > 0) {
|
|
|
|
apps = (
|
|
|
|
<div className={classes.AppGrid}>
|
|
|
|
{props.apps.map((app: App): JSX.Element => {
|
|
|
|
return <AppCard
|
|
|
|
key={app.id}
|
|
|
|
app={app}
|
|
|
|
/>
|
|
|
|
})}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
} else {
|
|
|
|
apps = (
|
|
|
|
<p className={classes.AppsMessage}>You don't have any applications. You can add a new one from <Link to='/applications'>/application</Link> menu</p>
|
|
|
|
);
|
|
|
|
}
|
2021-05-13 17:21:52 +02:00
|
|
|
|
|
|
|
return apps;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default AppGrid;
|