forked from cw118/totallyslay
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
175 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { useRef } from 'react'; | ||
import styles from '../styles/Puzzle.module.css'; | ||
import { motion } from 'framer-motion'; | ||
import PuzzlePieces from './PuzzlePieces'; | ||
|
||
const PuzzleArea = () => { | ||
const constraintsRef = useRef(null); | ||
|
||
return ( | ||
<div className={styles.piecesContainer}> | ||
<motion.div className={styles.area} ref={constraintsRef}> | ||
<div className={styles.quadrant} id={styles.one}></div> | ||
<div className={styles.quadrant} id={styles.two}></div> | ||
<div className={styles.quadrant} id={styles.three}></div> | ||
<div className={styles.quadrant} id={styles.four}></div> | ||
</motion.div> | ||
<PuzzlePieces constraintsRef={constraintsRef} /> | ||
</div> | ||
) | ||
} | ||
|
||
export default PuzzleArea; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { motion } from 'framer-motion'; | ||
import styles from '../styles/Puzzle.module.css'; | ||
|
||
const PuzzlePieces = ({ constraintsRef }) => { | ||
return ( | ||
<> | ||
<motion.div | ||
className={`${styles.piece} ` + `bottomLeft`} | ||
id={styles.pieceone} | ||
drag | ||
dragElastic={0.15} | ||
dragConstraints={constraintsRef} | ||
whileTap={{ opacity: 0.75 }}> | ||
</motion.div> | ||
<motion.div | ||
className={`${styles.piece} ` + `topLeft`} | ||
id={styles.piecetwo} | ||
drag | ||
dragElastic={0.15} | ||
dragConstraints={constraintsRef} | ||
whileTap={{ opacity: 0.75 }}> | ||
</motion.div> | ||
<motion.div | ||
className={`${styles.piece} ` + `topRight`} | ||
id={styles.piecethree} | ||
drag | ||
dragElastic={0.15} | ||
dragConstraints={constraintsRef} | ||
whileTap={{ opacity: 0.75 }}> | ||
</motion.div> | ||
<motion.div | ||
className={`${styles.piece} ` + `bottomRight`} | ||
id={styles.piecefour} | ||
drag | ||
dragElastic={0.15} | ||
dragConstraints={constraintsRef} | ||
whileTap={{ opacity: 0.75 }}> | ||
</motion.div> | ||
</> | ||
); | ||
} | ||
|
||
export default PuzzlePieces; | ||
// {shuffledIds.map((id, index) => <PuzzlePiece key={`${index}`} position={`${shuffledPositions[index]}`} idName={`${id}`} constraintsRef={constraintsRef} />)} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
export default function Home() { | ||
return ( | ||
<> | ||
<span>Hello</span> | ||
<p>Under construction</p> | ||
</> | ||
) | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import PuzzleArea from '../components/PuzzleArea'; | ||
import styles from '../styles/Puzzle.module.css'; | ||
|
||
const puzzle = () => { | ||
return ( | ||
<div className={styles.container}> | ||
<PuzzleArea /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default puzzle; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
.container { | ||
background: linear-gradient(180deg, #9c1aff 0%, rgb(119, 0, 255) 100%); | ||
width: 100vw; | ||
height: 100vh; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.quadrant { | ||
width: 150px; | ||
height: 125px; | ||
position: absolute; | ||
} | ||
|
||
#one { | ||
top: 0; | ||
left: 0; | ||
} | ||
|
||
#two { | ||
top: 0; | ||
right: 0; | ||
} | ||
|
||
#three { | ||
bottom: 0; | ||
left: 0; | ||
} | ||
|
||
#four { | ||
bottom: 0; | ||
right: 0; | ||
} | ||
|
||
.area { | ||
opacity: 0.2; | ||
background: white; | ||
width: 300px; | ||
height: 250px; | ||
position: relative; | ||
user-select: none; | ||
box-shadow: rgba(0, 0, 0, 0.75) 0px 5px 15px; | ||
} | ||
|
||
.piecesContainer { | ||
width: 300px; | ||
height: 250px; | ||
position: relative; | ||
} | ||
|
||
.piece { | ||
width: 150px; | ||
height: 125px; | ||
position: absolute; | ||
z-index: 999; | ||
} | ||
|
||
#pieceone { | ||
background-image: url(/puzzle/one.png); | ||
} | ||
|
||
#piecetwo { | ||
background-image: url(/puzzle/two.png); | ||
} | ||
|
||
#piecethree { | ||
background-image: url(/puzzle/three.png); | ||
} | ||
|
||
#piecefour { | ||
background-image: url(/puzzle/four.png); | ||
} |
This file contains 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