-
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
317 additions
and
51 deletions.
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
Binary file not shown.
Binary file not shown.
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
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,68 @@ | ||
import { css } from "@stitches/react"; | ||
import classNames from "classnames"; | ||
|
||
const cube = css({ | ||
position: "relative", | ||
transformStyle: "preserve-3d", | ||
}); | ||
|
||
const rotate45 = css({ | ||
transition: "all 300ms", | ||
transform: "rotateX(-9deg) rotateY(-80deg) rotate(0deg)", | ||
}); | ||
|
||
// might be half the surface size | ||
const translate = "32px"; | ||
|
||
// a face is a 2D "side" of a 3D object | ||
const cubeFace = css({ | ||
position: "absolute", | ||
width: "100%", | ||
height: "100%", | ||
|
||
variants: { | ||
side: { | ||
front: { | ||
background: | ||
"linear-gradient(to bottom left, hsl(0, 0%, 23%), hsl(0, 0%, 9%))", | ||
}, | ||
right: { | ||
transform: "rotateY(90deg) translateZ(var(--brick-z)) translateX(50%)", // TODO 121.5 = size - 10%/2 | ||
width: "9%", | ||
background: "linear-gradient(150deg, hsl(0, 0%, 23%), hsl(0, 0%, 9%))", | ||
}, | ||
top: { | ||
transform: | ||
"rotateX(90deg) translateZ(var(--brick-z)) translateX(0px) translateY(-50%)", | ||
width: "100%", | ||
height: "9%", | ||
background: "linear-gradient(336deg, hsl(0deg 0% 38%), hsl(0 0% 23%));", | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
export function Brick({ size = 128 }) { | ||
return ( | ||
<div | ||
className={classNames(cube(), rotate45())} | ||
style={{ width: size, height: size }} | ||
> | ||
<div className={classNames(cubeFace({ side: "front" }))} /> | ||
<div | ||
className={classNames(cubeFace({ side: "right" }))} | ||
style={{ | ||
// @ts-ignore | ||
"--brick-z": `${size * 0.95}px`, | ||
}} | ||
/> | ||
<div | ||
className={classNames(cubeFace({ side: "top" }))} | ||
style={{ | ||
// @ts-ignore | ||
"--brick-z": `${size * 0.045}px`, | ||
}} | ||
/> | ||
</div> | ||
); | ||
} |
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 @@ | ||
export { Brick } from "./brick"; |
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,9 +1,9 @@ | ||
export const times = { | ||
blink: "80ms", | ||
quick: "130ms", | ||
snappy: "210ms", | ||
normal: "330ms", | ||
relaxed: "485ms", | ||
long: "785ms", | ||
sloth: "1271ms", | ||
blink: 80, | ||
quick: 130, | ||
snappy: 210, | ||
normal: 330, | ||
relaxed: 485, | ||
long: 785, | ||
sloth: 1271, | ||
}; |
Oops, something went wrong.