-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathSecondShape.js
More file actions
70 lines (67 loc) · 2.03 KB
/
Copy pathSecondShape.js
File metadata and controls
70 lines (67 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import React from "react";
import { Grid } from "@mui/material";
import { IfVideoPreview } from "./IfVideoPreview";
import { imageBackground } from "./ShapesStyles";
const checkImage = (item) => {
if (item.type.includes("image")) {
return true;
}
return false;
};
const SecondShape = ({ images, openModal, sharp, cover }) => {
const conditionalRender = [3, 4].includes(images.length);
return (
<Grid container sx={{ height: 1 }}>
<Grid
item
xs={6}
container
direction="column"
onClick={() => openModal(conditionalRender ? 1 : 0)}
sx={{
...imageBackground,
border: !sharp && "2px solid white;",
borderRadius: !sharp && "6px;",
width: 0.5,
pt:
checkImage(conditionalRender ? images[1] : images[0]) &&
(cover ? "100%" : "50%"),
backgroundImage: `url(${
conditionalRender ? images[1].media : images[0].media
})`,
backgroundColor: "black",
backgroundSize: "cover",
}}
>
<Grid item xs={12} sx={{ height: 1, backgroundColor: "black" }}>
<IfVideoPreview item={conditionalRender ? images[1] : images[0]} />
</Grid>
</Grid>
<Grid
item
xs={6}
container
direction="column"
onClick={() => openModal(conditionalRender ? 2 : 1)}
sx={{
...imageBackground,
border: !sharp && "2px solid white;",
borderRadius: !sharp && "6px;",
width: 0.5,
pt:
checkImage(conditionalRender ? images[2] : images[1]) &&
(cover ? "100%" : "50%"),
background: `url(${
conditionalRender ? images[2].media : images[1].media
})`,
backgroundColor: "black",
}}
>
<Grid item xs={12} sx={{ height: 1, backgroundColor: "black" }}>
<IfVideoPreview item={conditionalRender ? images[2] : images[1]} />
</Grid>
</Grid>
</Grid>
);
};
export default SecondShape;