Move GridMenu to ui/

This commit is contained in:
J Francisco Rader committed 2020-08-22 16:02:25 -03:00
1 parent 34bfab2448
commit 0bbd463c01
2 files changed
+10 -10

No files matched your search

+2 -2
View File
@@ -1,14 +1,14 @@
import React from "react"; import React from "react";
import { AppWrapper } from "../../../ui/components"; import { AppWrapper } from "../../../ui/components";
import { GridMenu } from "./GridMenu";
import { Box } from "@material-ui/core"; import { Box } from "@material-ui/core";
import { useApps } from "../../appmarket/hooks/useApps"; import { useApps } from "../../appmarket/hooks/useApps";
import { GridMenu } from "../../../ui/components/GridMenu";
export const HomeApp = () => { export const HomeApp = () => {
const { apps } = useApps(); const { apps } = useApps();
return ( return (
<AppWrapper> <AppWrapper>
<Box width="100%" mt={6} px={1}>{apps && <GridMenu apps={apps.preinstalled} />}</Box> <Box width="100%" mt={6} px={1}>{apps && <GridMenu items={apps.preinstalled} />}</Box>
</AppWrapper> </AppWrapper>
); );
}; };
@@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import { AppIcon } from "../../../ui/components/AppIcon"; import { AppIcon } from "./AppIcon";
import { Grid, makeStyles } from "@material-ui/core"; import { Grid, makeStyles } from "@material-ui/core";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
@@ -13,23 +13,23 @@ const useStyles = makeStyles(theme => ({
} }
})); }));
export const GridMenu = ({ apps }) => { export const GridMenu = ({ items, Component = AppIcon }) => {
const classes = useStyles(); const classes = useStyles();
return ( return (
<Grid container justify="center"> <Grid container justify="center">
<Grid container item> <Grid container item>
{apps && {items &&
apps.length && items.length &&
apps.map((app) => ( items.map((item) => (
<Grid <Grid
item item
className={classes.item} className={classes.item}
key={app.name} key={item.name}
tabindex="-1" tabindex="-1"
component={Link} component={Link}
to={app.path} to={item.path}
> >
<AppIcon {...app} /> <Component {...item} />
</Grid> </Grid>
))} ))}
</Grid> </Grid>