-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Core Stripe setup * Webhooks and success/cancel pages * Order model, crud, routers, and page * Stripe env setup fixed and cleanup * Rename stripe env vars to have vite_ prefix * Webhooks, order creation and view flow * Stripe env rename and add to github workflows * Add order shipping address * Stompy micro product, price no longer hard coded * Fix lint
- Loading branch information
1 parent
66345b9
commit ad10447
Showing
31 changed files
with
1,461 additions
and
25 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,94 @@ | ||
import React from "react"; | ||
import useMeasure from "react-use-measure"; | ||
|
||
import { | ||
motion, | ||
useAnimate, | ||
useDragControls, | ||
useMotionValue, | ||
} from "framer-motion"; | ||
|
||
export const Drawer = ({ | ||
open, | ||
setOpen, | ||
children, | ||
}: { | ||
open: boolean; | ||
setOpen: (open: boolean) => void; | ||
children: React.ReactNode; | ||
}) => { | ||
const [scope, animate] = useAnimate(); | ||
const [drawerRef, { height }] = useMeasure(); | ||
|
||
const y = useMotionValue(0); | ||
const controls = useDragControls(); | ||
|
||
const handleClose = async () => { | ||
animate(scope.current, { | ||
opacity: [1, 0], | ||
}); | ||
|
||
const yStart = typeof y.get() === "number" ? y.get() : 0; | ||
|
||
await animate("#drawer", { | ||
y: [yStart, height], | ||
}); | ||
|
||
setOpen(false); | ||
}; | ||
|
||
return ( | ||
<> | ||
{open && ( | ||
<motion.div | ||
ref={scope} | ||
initial={{ opacity: 0 }} | ||
animate={{ opacity: 1 }} | ||
onClick={handleClose} | ||
className="fixed inset-0 z-50 bg-neutral-950/70" | ||
> | ||
<motion.div | ||
id="drawer" | ||
ref={drawerRef} | ||
onClick={(e) => e.stopPropagation()} | ||
initial={{ y: "100%" }} | ||
animate={{ y: "0%" }} | ||
transition={{ | ||
ease: "easeInOut", | ||
}} | ||
className="absolute bottom-0 h-[75vh] w-full overflow-hidden rounded-t-3xl bg-neutral-900" | ||
style={{ y }} | ||
drag="y" | ||
dragControls={controls} | ||
onDragEnd={() => { | ||
if (y.get() >= 100) { | ||
handleClose(); | ||
} | ||
}} | ||
dragListener={false} | ||
dragConstraints={{ | ||
top: 0, | ||
bottom: 0, | ||
}} | ||
dragElastic={{ | ||
top: 0, | ||
bottom: 0.5, | ||
}} | ||
> | ||
<div className="absolute left-0 right-0 top-0 z-10 flex justify-center bg-neutral-900 p-4"> | ||
<button | ||
onPointerDown={(e) => { | ||
controls.start(e); | ||
}} | ||
className="h-2 w-14 cursor-grab touch-none rounded-full bg-neutral-700 active:cursor-grabbing" | ||
></button> | ||
</div> | ||
<div className="relative z-0 h-full overflow-y-scroll p-4 pt-12"> | ||
{children} | ||
</div> | ||
</motion.div> | ||
</motion.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
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
Oops, something went wrong.