Last active
July 6, 2022 16:20
-
-
Save Code-Victor/72e15aa9f295a25aee885481ed813d89 to your computer and use it in GitHub Desktop.
layout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <Box | |
| css={{ | |
| minHeight: "100vh", | |
| minWidth: "100vw", | |
| display: "grid", | |
| placeItems: "center", | |
| }} | |
| > | |
| <Box | |
| css={{ display: "grid", gridTemplateColumns: "repeat(2,1fr)", gap: 20 }} | |
| > | |
| {data.map((item, i) => { | |
| if (selected === item.id) { | |
| return null; | |
| } | |
| return ( | |
| <Card key={item.id} layoutId={`${item.id}`} onClick={() => setSelected(item.id)}> | |
| <Box> | |
| <motion.img src={item.img} alt="top gun" /> | |
| </Box> | |
| <Box css={{ padding: 10 }}> | |
| <h1>{item.name}</h1> | |
| <p>{dummyText}</p> | |
| </Box> | |
| </Card> | |
| ); | |
| })} | |
| </Box> | |
| {selected && ( | |
| <Box | |
| css={{ | |
| display: "grid", | |
| placeItems: "center", | |
| position: "absolute", | |
| inset: 0, | |
| }} | |
| > | |
| <MainCard layoutId={`${selected}`}> | |
| <Box> | |
| <img src={data[(selected || 0) - 1].img} alt="top gun" /> | |
| </Box> | |
| <Box css={{ padding: 10 }}> | |
| <h1>{data[(selected || 0) - 1].name}</h1> | |
| <p>{dummyText}</p> | |
| <button onClick={() => setSelected(undefined)}>close</button> | |
| </Box> | |
| </MainCard> | |
| </Box> | |
| )} | |
| </Box> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment