mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
reorganization
This commit is contained in:
1 parent
11977c48ef
commit
2a6429c446
24 files changed
+43
-85
No files matched your search
@@ -0,0 +1,57 @@
|
||||
import React from "react";
|
||||
import { IconButton } from "@material-ui/core";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import CloseIcon from "@material-ui/icons/Close";
|
||||
|
||||
const useStyles = makeStyles(() => ({
|
||||
root: {
|
||||
margin: "2px 15px",
|
||||
},
|
||||
imageContainer: {
|
||||
// catch the close button here so it doesn't go all the way up to the modal
|
||||
position: "relative",
|
||||
display: "inline-block",
|
||||
},
|
||||
imgButton: {
|
||||
position: "absolute", // show the close button in the top right of the image
|
||||
top: "2px",
|
||||
right: "5px",
|
||||
backgroundColor: "#000",
|
||||
opacity: 0.7,
|
||||
"&:hover": {
|
||||
// fixes a bug where when the user closes one image material-ui puts
|
||||
// the hover status on the previous image
|
||||
backgroundColor: "#000",
|
||||
},
|
||||
},
|
||||
img: {
|
||||
maxHeight: "125px", // constrain images so we don't overwhelm the UI
|
||||
maxWidth: "300px",
|
||||
padding: "0px 3px 3px 0px",
|
||||
},
|
||||
imgSmall: {
|
||||
maxHeight: "200px", // constrain images so we don't overwhelm the UI
|
||||
maxWidth: "100%",
|
||||
padding: "0px 1px 1px 0px",
|
||||
},
|
||||
}));
|
||||
|
||||
export const Image = ({ link, handleClick, small }) => {
|
||||
const classes = useStyles();
|
||||
return (
|
||||
<div className={classes.imageContainer}>
|
||||
{handleClick && (
|
||||
<IconButton
|
||||
className={classes.imgButton}
|
||||
onClick={handleClick}
|
||||
size="small"
|
||||
>
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
)}
|
||||
<img className={small ? classes.imgSmall : classes.img} src={link} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Image;
|
||||
@@ -0,0 +1,29 @@
|
||||
import React from "react";
|
||||
|
||||
import Image from "./Image";
|
||||
|
||||
export const ImageDisplay = ({ visible, images, removeImage, small }) => {
|
||||
if (!visible || !images || images.length === 0) return null;
|
||||
|
||||
const styles = { margin: small ? "2px 0px" : "2px 15px" };
|
||||
|
||||
return (
|
||||
<div style={styles}>
|
||||
{images.map((image) => (
|
||||
<Image
|
||||
key={image.id}
|
||||
link={image.link}
|
||||
handleClick={removeImage ? () => removeImage(image.id) : null}
|
||||
small={small}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
ImageDisplay.defaultProps = {
|
||||
removeImage: null,
|
||||
small: false,
|
||||
};
|
||||
|
||||
export default ImageDisplay;
|
||||
@@ -0,0 +1,36 @@
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import { TextField } from "@material-ui/core";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
textField: {
|
||||
flex: "1 1 100%",
|
||||
padding: "10px 15px",
|
||||
marginTop: "15px",
|
||||
},
|
||||
textFieldInput: {
|
||||
fontSize: "22px",
|
||||
},
|
||||
}));
|
||||
|
||||
export const ImagePrompt = ({ visible, value, handleChange }) => {
|
||||
const { t } = useTranslation();
|
||||
const classes = useStyles();
|
||||
|
||||
if (!visible) return null;
|
||||
return (
|
||||
<TextField
|
||||
value={value}
|
||||
inputProps={{ className: classes.textFieldInput }}
|
||||
className={classes.textField}
|
||||
onChange={handleChange}
|
||||
multiline
|
||||
size="small"
|
||||
placeholder={t("APPS_TWITTER_IMAGE_PLACEHOLDER")}
|
||||
inputRef={(input) => input && input.focus()}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default ImagePrompt;
|
||||
Reference in new issue
Block a user