-
Notifications
You must be signed in to change notification settings - Fork 3
add points breakdown table and fix animation bugs #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
e0e3333
commit that shit
ashworks1706 e9aa0d5
Update src/components/Shop/CategorySection.tsx
benjuntilla 438101d
Update CategorySection component
ashworks1706 7101dce
commit that shit
ashworks1706 60b0390
commit that shit
ashworks1706 20cc443
added mid loop stopping
ashworks1706 8e85606
edited animation issues
ashworks1706 92e4a78
edited animation issues
ashworks1706 d223f97
Merge branch 'main' into commit-that-shit-v3
ashworks1706 695c3b3
Update src/components/Shop/PointsDrawer.tsx
ashworks1706 afe2dd6
Update src/pages/Shop/ShopIndex.tsx
ashworks1706 4012eb0
Update src/components/Shop/ProductCarousel.tsx
ashworks1706 e635e52
Update src/components/Shop/PointsBreakdownTable.tsx
ashworks1706 436f20e
Fix PointsDrawer hover/pin UX and PointsBreakdownTable accessibility …
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Binary file not shown.
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| import React, { useState, useRef } from "react"; | ||
| import PointsBreakdownTable from "./PointsBreakdownTable"; | ||
| import { ArrowLeft, X } from "lucide-react"; | ||
|
|
||
| /** | ||
| * Floating drawer that keeps the points table accessible across all shop pages. | ||
| * - Hover to preview, click to pin open, Escape or blur to close. | ||
| */ | ||
| const PointsDrawer: React.FC = () => { | ||
| const [isOpen, setIsOpen] = useState(false); | ||
| const [isPinned, setIsPinned] = useState(false); | ||
| const drawerRef = useRef<HTMLDivElement>(null); | ||
|
|
||
| const openDrawer = () => setIsOpen(true); | ||
|
|
||
| const closeDrawer = () => { | ||
| setIsOpen(false); | ||
| setIsPinned(false); | ||
| }; | ||
|
|
||
| const handleMouseEnter = () => setIsOpen(true); | ||
| const handleMouseLeave = () => { | ||
| if (!isPinned) setIsOpen(false); | ||
| }; | ||
|
|
||
| const handleTogglePin = () => { | ||
| setIsPinned((prev) => { | ||
| const next = !prev; | ||
| setIsOpen(next); | ||
| return next; | ||
| }); | ||
| }; | ||
|
|
||
| const handleKeyDown = (e: React.KeyboardEvent) => { | ||
| if (e.key === "Escape") closeDrawer(); | ||
| }; | ||
|
|
||
| const handleBlur = (e: React.FocusEvent<HTMLDivElement>) => { | ||
| if (drawerRef.current && !drawerRef.current.contains(e.relatedTarget as Node)) { | ||
| if (!isPinned) setIsOpen(false); | ||
| } | ||
| }; | ||
|
|
||
| const translateClass = isOpen ? "translate-x-0" : "translate-x-[calc(100%-2rem)]"; | ||
|
|
||
| return ( | ||
| <> | ||
| <div | ||
| ref={drawerRef} | ||
| className="fixed top-1/2 right-[-6px] -translate-y-1/2 z-40 group/drawer hidden md:block" | ||
| onKeyDown={handleKeyDown} | ||
| onBlur={handleBlur} | ||
| > | ||
| <div | ||
| className={`flex items-center transition-transform duration-300 ease-out ${translateClass}`} | ||
| onMouseEnter={handleMouseEnter} | ||
| onMouseLeave={handleMouseLeave} | ||
| > | ||
| <button | ||
| type="button" | ||
| className="bg-blue-500/20 backdrop-blur-md text-white w-4 sm:w-5 px-0.5 py-3 border border-white/15 shadow-lg shadow-blue-500/10 text-[10px] font-semibold tracking-[0.25em] uppercase h-[23vh] flex items-center justify-between cursor-pointer select-none" | ||
| style={{ writingMode: "vertical-rl" }} | ||
| onClick={handleTogglePin} | ||
| onFocus={openDrawer} | ||
| aria-expanded={isOpen} | ||
| aria-controls="points-breakdown-desktop-panel" | ||
| > | ||
| <ArrowLeft size={20} color="grey" /> Points Breakdown{" "} | ||
| <ArrowLeft size={20} color="grey" /> | ||
| </button> | ||
| <div | ||
| id="points-breakdown-desktop-panel" | ||
| className="w-[340px] max-h-[80vh] overflow-y-auto border border-white/10 rounded-l-none rounded-r-xl" | ||
| > | ||
| <PointsBreakdownTable /> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className="fixed bottom-4 right-4 z-40 md:hidden"> | ||
| {!isOpen ? ( | ||
| <button | ||
| type="button" | ||
| onClick={openDrawer} | ||
| className="bg-blue-500/20 backdrop-blur-md text-white border border-white/15 shadow-lg shadow-blue-500/10 rounded-full px-4 py-2 text-xs font-semibold uppercase tracking-wider" | ||
| > | ||
| Points | ||
| </button> | ||
| ) : ( | ||
| <div className="w-[calc(100vw-2rem)] max-w-sm"> | ||
| <div className="flex items-center justify-end mb-2"> | ||
| <button | ||
| type="button" | ||
| onClick={closeDrawer} | ||
| aria-label="Close points breakdown" | ||
| className="bg-black/40 backdrop-blur-md text-white border border-white/15 rounded-full p-2" | ||
| > | ||
| <X size={16} /> | ||
| </button> | ||
| </div> | ||
| <div className="max-h-[65vh] overflow-y-auto border border-white/10 rounded-xl"> | ||
| <PointsBreakdownTable /> | ||
| </div> | ||
| </div> | ||
| )} | ||
| </div> | ||
| </> | ||
| ); | ||
| }; | ||
|
|
||
| export default PointsDrawer; |
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
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.