mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
I really hope I didnt fuck anything up now
This commit is contained in:
1 parent
ad20755608
commit
ec37fcde46
67 files changed
No files matched your search
@@ -0,0 +1,39 @@
|
||||
import React from "react";
|
||||
import { Box, makeStyles, Backdrop, Paper } from "@material-ui/core";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
box: {
|
||||
width: "100%",
|
||||
position: "relative",
|
||||
},
|
||||
backdrop: {
|
||||
position: "absolute",
|
||||
zIndex: 1,
|
||||
},
|
||||
paper: {
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
},
|
||||
}));
|
||||
|
||||
export const AppContent = ({
|
||||
children,
|
||||
style,
|
||||
backdrop,
|
||||
onClickBackdrop,
|
||||
...props
|
||||
}) => {
|
||||
const classes = useStyles();
|
||||
return (
|
||||
<Box flexGrow={1} className={classes.box} {...props}>
|
||||
<Paper square px={2} pt={1} elevation={0} className={classes.paper}>
|
||||
<Backdrop
|
||||
className={classes.backdrop}
|
||||
open={backdrop || false}
|
||||
onClick={onClickBackdrop}
|
||||
></Backdrop>
|
||||
{children}
|
||||
</Paper>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
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),
|
||||
},
|
||||
padding: 0
|
||||
},
|
||||
avatar: {
|
||||
backgroundColor: ({ backgroundColor }) => backgroundColor,
|
||||
color: ({ color }) => color,
|
||||
width: theme.spacing(7),
|
||||
height: theme.spacing(7),
|
||||
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>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
import React from "react";
|
||||
import { Typography, Box, makeStyles } from "@material-ui/core";
|
||||
|
||||
const useStyle = makeStyles(theme => ({
|
||||
root: ({ color }) => ({
|
||||
width: '100%',
|
||||
textAlign: 'center',
|
||||
backgroundColor: color || theme.palette.background.default
|
||||
}),
|
||||
text: {
|
||||
color: theme.palette.text.primary
|
||||
}
|
||||
}));
|
||||
|
||||
export const AppTitle = ({ children, color, ...props }) => {
|
||||
const classes = useStyle({ color });
|
||||
return (
|
||||
<Box px={2} pt={4} className={classes.root} {...props}>
|
||||
<Typography className={classes.text} paragraph variant="h4">{children}</Typography>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,21 @@
|
||||
import React from "react";
|
||||
|
||||
export const AppWrapper = ({ children, style, handleClickAway, ...props }) => {
|
||||
return (
|
||||
<div
|
||||
{...props}
|
||||
style={{
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
display: "flex",
|
||||
position: 'relative',
|
||||
flexDirection: "column",
|
||||
...style,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
import React from "react";
|
||||
import MaterialButton from "@material-ui/core/Button";
|
||||
|
||||
export const Button = ({ ...props }) => {
|
||||
return (
|
||||
<MaterialButton aria-label="button" {...props}>
|
||||
{props.children}
|
||||
</MaterialButton>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
import React from "react";
|
||||
import {
|
||||
ListItemIcon,
|
||||
ListItemText,
|
||||
Slide,
|
||||
makeStyles,
|
||||
Paper,
|
||||
} from "@material-ui/core";
|
||||
import { List } from "./List";
|
||||
import { ListItem } from "./ListItem";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
width: "100%",
|
||||
position: "absolute",
|
||||
bottom: 0,
|
||||
zIndex: 2,
|
||||
},
|
||||
}));
|
||||
|
||||
export const ContextMenu = ({ open, onClose, options }) => {
|
||||
const classes = useStyles();
|
||||
return (
|
||||
<Slide direction="up" in={open} mountOnEnter unmountOnExit>
|
||||
<Paper square className={classes.root}>
|
||||
<List>
|
||||
{options.map((option) => (
|
||||
<ListItem
|
||||
selected={option.selected}
|
||||
key={option.key || option.label}
|
||||
button
|
||||
onClick={(e) => {
|
||||
option.onClick(e, option);
|
||||
onClose();
|
||||
}}
|
||||
>
|
||||
{option.icon && <ListItemIcon>{option.icon}</ListItemIcon>}
|
||||
<ListItemText primary={option.label} />
|
||||
</ListItem>
|
||||
))}
|
||||
</List>
|
||||
</Paper>
|
||||
</Slide>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
import React, { useEffect } from "react";
|
||||
import { AppIcon } from "./AppIcon";
|
||||
import { Grid, makeStyles } from "@material-ui/core";
|
||||
import { Link } from "react-router-dom";
|
||||
import { useKeyboard } from "../../os/hooks/useKeyboard";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
marginTop: theme.spacing(3),
|
||||
},
|
||||
item: {
|
||||
marginTop: theme.spacing(3),
|
||||
width: "20%",
|
||||
},
|
||||
}));
|
||||
|
||||
export const GridMenu = ({ items, Component = AppIcon }) => {
|
||||
const setKey = useKeyboard();
|
||||
const classes = useStyles();
|
||||
|
||||
useEffect(function registerKeyHandlers() {
|
||||
setKey("ArrowLeft", () => {
|
||||
console.log(":v");
|
||||
});
|
||||
// eslint-disable-next-line
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Grid container justify="center">
|
||||
<Grid container item>
|
||||
{items &&
|
||||
items.length &&
|
||||
items.map((item) => (
|
||||
<Grid
|
||||
item
|
||||
className={classes.item}
|
||||
key={item.name}
|
||||
tabIndex="-1"
|
||||
component={Link}
|
||||
to={item.path}
|
||||
>
|
||||
<Component {...item} />
|
||||
</Grid>
|
||||
))}
|
||||
</Grid>
|
||||
</Grid>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
import React from "react";
|
||||
import MaterialList from "@material-ui/core/List";
|
||||
|
||||
export const List = ({ ...props }) => {
|
||||
return (
|
||||
<MaterialList aria-label="list" {...props}>
|
||||
{props.children}
|
||||
</MaterialList>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
import React from "react";
|
||||
import MaterialListItem from "@material-ui/core/ListItem";
|
||||
|
||||
export const ListItem = ({ ...props }) => {
|
||||
return (
|
||||
<MaterialListItem aria-label="list item" {...props}>
|
||||
{props.children}
|
||||
</MaterialListItem>
|
||||
);
|
||||
};
|
||||
Whitespace-only changes.
@@ -0,0 +1 @@
|
||||
export * from './AppWrapper';
|
||||
@@ -0,0 +1,30 @@
|
||||
import React, { useState } from "react";
|
||||
import { ContextMenu } from "../components/ContextMenu";
|
||||
|
||||
export const MapStringOptions = (current, onClick) => (string) => {
|
||||
return {
|
||||
selected: current === string,
|
||||
label: string,
|
||||
key: string,
|
||||
onClick: () => onClick(string)
|
||||
};
|
||||
};
|
||||
|
||||
export const useContextMenu = (_options = []) => {
|
||||
const [open, setOpen] = useState();
|
||||
const [options, setOptions] = useState(_options);
|
||||
|
||||
const onClose = () => setOpen(false);
|
||||
|
||||
const onOpen = (opts) => {
|
||||
setOptions(opts);
|
||||
setOpen(true);
|
||||
};
|
||||
|
||||
return [
|
||||
onOpen,
|
||||
onClose,
|
||||
() => <ContextMenu open={open} onClose={onClose} options={options} />,
|
||||
open,
|
||||
];
|
||||
};
|
||||
Whitespace-only changes.
Reference in new issue
Block a user