mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
Improve AppIcon
This commit is contained in:
1 parent
2b94b56c92
commit
205dcabf12
5 files changed
+40
-28
No files matched your search
@@ -1,6 +1,7 @@
|
|||||||
import React, { createContext, useEffect } from "react";
|
import React, { createContext, useEffect } from "react";
|
||||||
import { useConfig } from "../../../config/hooks/useConfig";
|
import { useConfig } from "../../../config/hooks/useConfig";
|
||||||
import ContactsIcon from "@material-ui/icons/Contacts";
|
import ContactsIcon from "@material-ui/icons/Contacts";
|
||||||
|
import { blue } from "@material-ui/core/colors";
|
||||||
|
|
||||||
const AppsContext = createContext(null);
|
const AppsContext = createContext(null);
|
||||||
|
|
||||||
@@ -12,6 +13,8 @@ export const useApps = () => {
|
|||||||
{
|
{
|
||||||
name: "Contacts",
|
name: "Contacts",
|
||||||
icon: <ContactsIcon />,
|
icon: <ContactsIcon />,
|
||||||
|
backgroundColor: blue[500],
|
||||||
|
color: blue[50]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Contacts1",
|
name: "Contacts1",
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
import React from "react";
|
|
||||||
import { makeStyles } from "@material-ui/core/styles";
|
|
||||||
import Avatar from "@material-ui/core/Avatar";
|
|
||||||
import { Button } from "@material-ui/core";
|
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
|
||||||
root: {
|
|
||||||
display: 'flex',
|
|
||||||
'& > *': {
|
|
||||||
margin: theme.spacing(1),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
avatar: {
|
|
||||||
width: theme.spacing(8),
|
|
||||||
height: theme.spacing(8),
|
|
||||||
fontSize: theme.typography.h4.fontSize
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
export const AppIcon = ({ label, icon }) => {
|
|
||||||
const classes = useStyles();
|
|
||||||
return <Button className={classes.root}><Avatar className={classes.avatar}>{icon || label[0].toUpperCase()}</Avatar></Button>;
|
|
||||||
};
|
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { AppIcon } from "./AppIcon";
|
import { AppIcon } from "../../../ui/components/AppIcon";
|
||||||
import { Grid } from "@material-ui/core";
|
import { Grid } from "@material-ui/core";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
export const GridMenu = ({ apps }) => {
|
export const GridMenu = ({ apps }) => {
|
||||||
return (
|
return (
|
||||||
<Grid container spacing={1}>
|
<Grid container>
|
||||||
{apps && apps.length && apps.map((app) => (
|
{apps && apps.length && apps.map((app) => (
|
||||||
<Grid item key={app.name} component={Link} to="/contacts">
|
<Grid item xs={3} key={app.name} component={Link} to="/contacts">
|
||||||
<AppIcon icon={app.icon} label={app.name} />
|
<AppIcon {...app} />
|
||||||
</Grid>
|
</Grid>
|
||||||
))}
|
))}
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export const HomeApp = () => {
|
|||||||
backgroundImage: `${process.env.PUBLIC_URL}url(/media/backgrounds/${settings.wallpaper})`,
|
backgroundImage: `${process.env.PUBLIC_URL}url(/media/backgrounds/${settings.wallpaper})`,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box padding={2}>{apps && <GridMenu apps={apps.preinstalled} />}</Box>
|
<Box mt={6} px={4}>{apps && <GridMenu apps={apps.preinstalled} />}</Box>
|
||||||
</AppWrapper>
|
</AppWrapper>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { makeStyles } from "@material-ui/core/styles";
|
||||||
|
import Avatar from "@material-ui/core/Avatar";
|
||||||
|
import { green } from "@material-ui/core/colors";
|
||||||
|
import { Button } from "@material-ui/core";
|
||||||
|
|
||||||
|
const useStyles = makeStyles((theme) => ({
|
||||||
|
root: {
|
||||||
|
display: "flex",
|
||||||
|
"& > *": {
|
||||||
|
margin: theme.spacing(1),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
avatar: {
|
||||||
|
backgroundColor: ({ backgroundColor }) => backgroundColor,
|
||||||
|
color: ({ color }) => color,
|
||||||
|
width: theme.spacing(8),
|
||||||
|
height: theme.spacing(8),
|
||||||
|
fontSize: theme.typography.h4.fontSize,
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
export const AppIcon = ({ name, icon, backgroundColor, color }) => {
|
||||||
|
const classes = useStyles({ backgroundColor: backgroundColor || green[50], color: color || green[400] });
|
||||||
|
return (
|
||||||
|
<Button className={classes.root}>
|
||||||
|
<Avatar className={classes.avatar}>
|
||||||
|
{icon || name[0].toUpperCase()}
|
||||||
|
</Avatar>
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
};
|
||||||
Reference in new issue
Block a user