mirror of
https://github.com/vercel/commerce.git
synced 2025-05-17 06:56:59 +00:00
resolve GitHub PR comments
This commit is contained in:
parent
97c2d450be
commit
c863603b74
@ -28,14 +28,14 @@ export default function DeleteItemButton({ item }: { item: CartItem }) {
|
|||||||
}}
|
}}
|
||||||
disabled={isPending}
|
disabled={isPending}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
'ease flex h-[17px] w-[17px] items-center justify-center rounded-full bg-base-gray-900 transition-all duration-200 ',
|
'ease flex h-[17px] w-[17px] items-center justify-center rounded-full bg-stone-500 transition-all duration-200',
|
||||||
{
|
{
|
||||||
'cursor-not-allowed px-0': isPending
|
'cursor-not-allowed px-0': isPending
|
||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{isPending ? (
|
{isPending ? (
|
||||||
<LoadingDots className="bg-white " />
|
<LoadingDots className="bg-white" />
|
||||||
) : (
|
) : (
|
||||||
<CloseIcon className="hover:text-accent-3 mx-[1px] h-4 w-4 text-white dark:text-black" />
|
<CloseIcon className="hover:text-accent-3 mx-[1px] h-4 w-4 text-white dark:text-black" />
|
||||||
)}
|
)}
|
||||||
|
@ -52,9 +52,9 @@ export default function EditItemQuantityButton({
|
|||||||
{isPending ? (
|
{isPending ? (
|
||||||
<LoadingDots className="bg-black dark:bg-white" />
|
<LoadingDots className="bg-black dark:bg-white" />
|
||||||
) : type === 'plus' ? (
|
) : type === 'plus' ? (
|
||||||
<PlusIcon className="h-4 w-4 dark:text-base-gray-900" />
|
<PlusIcon className="h-4 w-4 dark:text-stone-500" />
|
||||||
) : (
|
) : (
|
||||||
<MinusIcon className="h-4 w-4 dark:text-base-gray-900" />
|
<MinusIcon className="h-4 w-4 dark:text-stone-500" />
|
||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { Dialog, Transition } from '@headlessui/react';
|
import { Dialog, Transition } from '@headlessui/react';
|
||||||
import Image from 'next/image';
|
import { ShoppingCartIcon } from '@heroicons/react/24/solid';
|
||||||
import Link from 'next/link';
|
|
||||||
|
|
||||||
import CartIcon from 'components/icons/cart';
|
import CartIcon from 'components/icons/cart';
|
||||||
import ShoppingCartIcon from 'components/icons/shopping-cart';
|
|
||||||
import Price from 'components/price';
|
import Price from 'components/price';
|
||||||
import { DEFAULT_OPTION } from 'lib/constants';
|
import { DEFAULT_OPTION } from 'lib/constants';
|
||||||
import type { Cart } from 'lib/shopify/types';
|
import type { Cart } from 'lib/shopify/types';
|
||||||
import { createUrl } from 'lib/utils';
|
import { createUrl } from 'lib/utils';
|
||||||
|
import Image from 'next/image';
|
||||||
|
import Link from 'next/link';
|
||||||
import { Fragment, useEffect, useRef, useState } from 'react';
|
import { Fragment, useEffect, useRef, useState } from 'react';
|
||||||
import { useCookies } from 'react-cookie';
|
import { useCookies } from 'react-cookie';
|
||||||
import DeleteItemButton from './delete-item-button';
|
import DeleteItemButton from './delete-item-button';
|
||||||
@ -66,7 +65,7 @@ export default function CartModal({ cart, cartIdUpdated }: { cart: Cart; cartIdU
|
|||||||
leaveFrom="opacity-100 backdrop-blur-[.5px]"
|
leaveFrom="opacity-100 backdrop-blur-[.5px]"
|
||||||
leaveTo="opacity-0 backdrop-blur-none"
|
leaveTo="opacity-0 backdrop-blur-none"
|
||||||
>
|
>
|
||||||
<div className="fixed inset-0 " aria-hidden="true" />
|
<div className="fixed inset-0 bg-black/30" aria-hidden="true" />
|
||||||
</Transition.Child>
|
</Transition.Child>
|
||||||
<Transition.Child
|
<Transition.Child
|
||||||
as={Fragment}
|
as={Fragment}
|
||||||
@ -77,12 +76,12 @@ export default function CartModal({ cart, cartIdUpdated }: { cart: Cart; cartIdU
|
|||||||
leaveFrom="translate-x-0"
|
leaveFrom="translate-x-0"
|
||||||
leaveTo="translate-x-full"
|
leaveTo="translate-x-full"
|
||||||
>
|
>
|
||||||
<Dialog.Panel className="fixed bottom-0 right-0 top-0 flex h-full w-full flex-col bg-white/80 p-6 text-black backdrop-blur-xl dark:bg-black/80 dark:text-white md:w-[390px]">
|
<Dialog.Panel className="fixed bottom-0 right-0 top-0 flex h-full w-full flex-col border-l border-gray-200 bg-white/80 p-6 text-black backdrop-blur-xl dark:border-neutral-700 dark:bg-black/80 dark:text-white md:w-[390px]">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<p className="text-lg font-semibold">My Cart</p>
|
<p className="text-lg font-semibold">My Cart</p>
|
||||||
|
|
||||||
<button aria-label="Close cart" onClick={closeCart} data-testid="close-cart">
|
<button aria-label="Close cart" onClick={closeCart} data-testid="close-cart">
|
||||||
<CartIcon quantity={cart.totalQuantity} />
|
<CartIcon quantity={cart.totalQuantity} icon="close" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -112,7 +111,7 @@ export default function CartModal({ cart, cartIdUpdated }: { cart: Cart; cartIdU
|
|||||||
<li
|
<li
|
||||||
key={i}
|
key={i}
|
||||||
data-testid="cart-item"
|
data-testid="cart-item"
|
||||||
className="flex w-full flex-col border-b border-black/[8%] dark:border-dark-gray-4"
|
className="flex w-full flex-col border-b border-zinc-300 dark:border-neutral-700"
|
||||||
>
|
>
|
||||||
<div className="relative flex w-full flex-row justify-between py-4">
|
<div className="relative flex w-full flex-row justify-between py-4">
|
||||||
<div className="absolute z-40 -mt-2 ml-[55px]">
|
<div className="absolute z-40 -mt-2 ml-[55px]">
|
||||||
@ -123,7 +122,7 @@ export default function CartModal({ cart, cartIdUpdated }: { cart: Cart; cartIdU
|
|||||||
onClick={closeCart}
|
onClick={closeCart}
|
||||||
className="z-30 flex flex-row space-x-4"
|
className="z-30 flex flex-row space-x-4"
|
||||||
>
|
>
|
||||||
<div className="relative h-16 w-16 cursor-pointer overflow-hidden rounded-md border border-black/[8%] bg-black/[5%] dark:border-dark-gray-4 dark:bg-white/[6.6%] dark:hover:bg-white/[8.7%]">
|
<div className="relative h-16 w-16 cursor-pointer overflow-hidden rounded-md border border-zinc-300 bg-zinc-300 dark:border-neutral-700 dark:bg-neutral-900 dark:hover:bg-neutral-800">
|
||||||
<Image
|
<Image
|
||||||
className="h-full w-full object-cover "
|
className="h-full w-full object-cover "
|
||||||
width={64}
|
width={64}
|
||||||
@ -142,7 +141,7 @@ export default function CartModal({ cart, cartIdUpdated }: { cart: Cart; cartIdU
|
|||||||
</span>
|
</span>
|
||||||
{item.merchandise.title !== DEFAULT_OPTION ? (
|
{item.merchandise.title !== DEFAULT_OPTION ? (
|
||||||
<p
|
<p
|
||||||
className="text-sm text-dark-gray-7 dark:text-white/[54%]"
|
className="text-sm text-neutral-800"
|
||||||
data-testid="cart-product-variant"
|
data-testid="cart-product-variant"
|
||||||
>
|
>
|
||||||
{item.merchandise.title}
|
{item.merchandise.title}
|
||||||
@ -156,10 +155,10 @@ export default function CartModal({ cart, cartIdUpdated }: { cart: Cart; cartIdU
|
|||||||
amount={item.cost.totalAmount.amount}
|
amount={item.cost.totalAmount.amount}
|
||||||
currencyCode={item.cost.totalAmount.currencyCode}
|
currencyCode={item.cost.totalAmount.currencyCode}
|
||||||
/>
|
/>
|
||||||
<div className="ml-auto flex h-9 flex-row items-center rounded-full border border-dark-gray-4">
|
<div className="ml-auto flex h-9 flex-row items-center rounded-full border border-gray-200 dark:border-neutral-700">
|
||||||
<EditItemQuantityButton item={item} type="minus" />
|
<EditItemQuantityButton item={item} type="minus" />
|
||||||
<p className="">
|
<p className="w-6 text-center ">
|
||||||
<span className="w-full px-2 text-sm">{item.quantity}</span>
|
<span className="w-full text-sm">{item.quantity}</span>
|
||||||
</p>
|
</p>
|
||||||
<EditItemQuantityButton item={item} type="plus" />
|
<EditItemQuantityButton item={item} type="plus" />
|
||||||
</div>
|
</div>
|
||||||
@ -169,8 +168,8 @@ export default function CartModal({ cart, cartIdUpdated }: { cart: Cart; cartIdU
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</ul>
|
</ul>
|
||||||
<div className="py-4 text-sm text-black/[44%] dark:text-white/[54%]">
|
<div className="py-4 text-sm text-neutral-400 dark:text-zinc-500">
|
||||||
<div className="mb-3 flex items-center justify-between border-b border-black/[8%] pb-1 dark:border-dark-gray-4">
|
<div className="mb-3 flex items-center justify-between border-b border-neutral-200 pb-1 dark:border-neutral-700">
|
||||||
<p>Taxes</p>
|
<p>Taxes</p>
|
||||||
<Price
|
<Price
|
||||||
className="text-right text-base text-black dark:text-white"
|
className="text-right text-base text-black dark:text-white"
|
||||||
@ -178,11 +177,11 @@ export default function CartModal({ cart, cartIdUpdated }: { cart: Cart; cartIdU
|
|||||||
currencyCode={cart.cost.totalTaxAmount.currencyCode}
|
currencyCode={cart.cost.totalTaxAmount.currencyCode}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-3 flex items-center justify-between border-b border-black/[8%] pb-1 pt-1 dark:border-dark-gray-4">
|
<div className="mb-3 flex items-center justify-between border-b border-neutral-200 pb-1 pt-1 dark:border-neutral-700">
|
||||||
<p>Shipping</p>
|
<p>Shipping</p>
|
||||||
<p className="text-right">Calculated at checkout</p>
|
<p className="text-right">Calculated at checkout</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-3 flex items-center justify-between border-b border-black/[8%] pb-1 pt-1 dark:border-dark-gray-4">
|
<div className="mb-3 flex items-center justify-between border-b border-neutral-200 pb-1 pt-1 dark:border-neutral-700">
|
||||||
<p>Total</p>
|
<p>Total</p>
|
||||||
<Price
|
<Price
|
||||||
className="text-right text-base text-black dark:text-white"
|
className="text-right text-base text-black dark:text-white"
|
||||||
@ -193,7 +192,7 @@ export default function CartModal({ cart, cartIdUpdated }: { cart: Cart; cartIdU
|
|||||||
</div>
|
</div>
|
||||||
<a
|
<a
|
||||||
href={cart.checkoutUrl}
|
href={cart.checkoutUrl}
|
||||||
className="flex w-full items-center justify-center rounded-full bg-vercel-blue p-3 text-sm font-medium text-white opacity-90 hover:opacity-100"
|
className="flex w-full items-center justify-center rounded-full bg-blue-600 p-3 text-sm font-medium text-white opacity-90 hover:opacity-100"
|
||||||
>
|
>
|
||||||
<span>Proceed to Checkout</span>
|
<span>Proceed to Checkout</span>
|
||||||
</a>
|
</a>
|
||||||
|
@ -1,20 +1,28 @@
|
|||||||
|
import { ShoppingCartIcon } from '@heroicons/react/24/solid';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import ShoppingCartIcon from './shopping-cart';
|
import CloseIcon from './close';
|
||||||
|
|
||||||
export default function CartIcon({
|
export default function CartIcon({
|
||||||
className,
|
className,
|
||||||
quantity
|
quantity,
|
||||||
|
icon
|
||||||
}: {
|
}: {
|
||||||
className?: string;
|
className?: string;
|
||||||
quantity?: number;
|
quantity?: number;
|
||||||
|
icon?: string;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<div className="relative flex h-11 w-11 items-center justify-center rounded-md border border-light-gray-4 text-black transition-colors dark:border-dark-gray-4 dark:text-white">
|
<div className="relative flex h-11 w-11 items-center justify-center rounded-md border border-gray-200 text-black transition-colors dark:border-neutral-700 dark:text-white">
|
||||||
|
{icon === 'close' ? (
|
||||||
|
<CloseIcon className={clsx('h-6 transition-all ease-in-out hover:scale-110 ', className)} />
|
||||||
|
) : (
|
||||||
<ShoppingCartIcon
|
<ShoppingCartIcon
|
||||||
className={clsx('h-6 transition-all ease-in-out hover:scale-110 ', className)}
|
className={clsx('h-4 transition-all ease-in-out hover:scale-110 ', className)}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
{quantity ? (
|
{quantity ? (
|
||||||
<div className="absolute right-0 top-0 -mr-2 -mt-2 h-4 w-4 rounded bg-vercel-blue text-[11px] font-medium text-white">
|
<div className="absolute right-0 top-0 -mr-2 -mt-2 h-4 w-4 rounded bg-blue-600 text-[11px] font-medium text-white">
|
||||||
{quantity}
|
{quantity}
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
export default function ShoppingCartIcon({ className }: { className?: string }) {
|
|
||||||
return (
|
|
||||||
<svg
|
|
||||||
className={className}
|
|
||||||
width="16"
|
|
||||||
height="16"
|
|
||||||
viewBox="0 0 16 16"
|
|
||||||
fill="none"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
>
|
|
||||||
<g clip-path="url(#clip0_137_611)">
|
|
||||||
<path
|
|
||||||
d="M6.00004 14.6667C6.36823 14.6667 6.66671 14.3682 6.66671 14C6.66671 13.6319 6.36823 13.3334 6.00004 13.3334C5.63185 13.3334 5.33337 13.6319 5.33337 14C5.33337 14.3682 5.63185 14.6667 6.00004 14.6667Z"
|
|
||||||
stroke="currentColor"
|
|
||||||
stroke-width="1.5"
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
/>
|
|
||||||
<path
|
|
||||||
d="M13.3333 14.6667C13.7015 14.6667 14 14.3682 14 14C14 13.6319 13.7015 13.3334 13.3333 13.3334C12.9651 13.3334 12.6666 13.6319 12.6666 14C12.6666 14.3682 12.9651 14.6667 13.3333 14.6667Z"
|
|
||||||
stroke="currentColor"
|
|
||||||
stroke-width="1.5"
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
/>
|
|
||||||
<path
|
|
||||||
d="M0.666626 0.666687H3.33329L5.11996 9.59335C5.18092 9.90028 5.3479 10.176 5.59166 10.3722C5.83541 10.5684 6.14042 10.6727 6.45329 10.6667H12.9333C13.2462 10.6727 13.5512 10.5684 13.7949 10.3722C14.0387 10.176 14.2057 9.90028 14.2666 9.59335L15.3333 4.00002H3.99996"
|
|
||||||
stroke="currentColor"
|
|
||||||
stroke-width="1.5"
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
/>
|
|
||||||
</g>
|
|
||||||
<defs>
|
|
||||||
<clipPath id="clip0_137_611">
|
|
||||||
<rect width="16" height="16" fill="currentColor" />
|
|
||||||
</clipPath>
|
|
||||||
</defs>
|
|
||||||
</svg>
|
|
||||||
);
|
|
||||||
}
|
|
@ -23,6 +23,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@headlessui/react": "^1.7.15",
|
"@headlessui/react": "^1.7.15",
|
||||||
|
"@heroicons/react": "^2.0.18",
|
||||||
"clsx": "^1.2.1",
|
"clsx": "^1.2.1",
|
||||||
"next": "13.4.9-canary.2",
|
"next": "13.4.9-canary.2",
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
|
10
pnpm-lock.yaml
generated
10
pnpm-lock.yaml
generated
@ -2,6 +2,7 @@ lockfileVersion: 5.4
|
|||||||
|
|
||||||
specifiers:
|
specifiers:
|
||||||
'@headlessui/react': ^1.7.15
|
'@headlessui/react': ^1.7.15
|
||||||
|
'@heroicons/react': ^2.0.18
|
||||||
'@playwright/test': ^1.35.1
|
'@playwright/test': ^1.35.1
|
||||||
'@tailwindcss/typography': ^0.5.9
|
'@tailwindcss/typography': ^0.5.9
|
||||||
'@types/node': 20.3.2
|
'@types/node': 20.3.2
|
||||||
@ -27,6 +28,7 @@ specifiers:
|
|||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
'@headlessui/react': 1.7.15_biqbaboplfbrettd7655fr4n2y
|
'@headlessui/react': 1.7.15_biqbaboplfbrettd7655fr4n2y
|
||||||
|
'@heroicons/react': 2.0.18_react@18.2.0
|
||||||
clsx: 1.2.1
|
clsx: 1.2.1
|
||||||
next: 13.4.9-canary.2_biqbaboplfbrettd7655fr4n2y
|
next: 13.4.9-canary.2_biqbaboplfbrettd7655fr4n2y
|
||||||
react: 18.2.0
|
react: 18.2.0
|
||||||
@ -141,6 +143,14 @@ packages:
|
|||||||
react-dom: 18.2.0_react@18.2.0
|
react-dom: 18.2.0_react@18.2.0
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@heroicons/react/2.0.18_react@18.2.0:
|
||||||
|
resolution: {integrity: sha512-7TyMjRrZZMBPa+/5Y8lN0iyvUU/01PeMGX2+RE7cQWpEUIcb4QotzUObFkJDejj/HUH4qjP/eQ0gzzKs2f+6Yw==}
|
||||||
|
peerDependencies:
|
||||||
|
react: '>= 16'
|
||||||
|
dependencies:
|
||||||
|
react: 18.2.0
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@humanwhocodes/config-array/0.11.10:
|
/@humanwhocodes/config-array/0.11.10:
|
||||||
resolution: {integrity: sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==}
|
resolution: {integrity: sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==}
|
||||||
engines: {node: '>=10.10.0'}
|
engines: {node: '>=10.10.0'}
|
||||||
|
@ -19,12 +19,7 @@ module.exports = {
|
|||||||
hotPink: '#FF1966',
|
hotPink: '#FF1966',
|
||||||
dark: '#111111',
|
dark: '#111111',
|
||||||
light: '#FAFAFA',
|
light: '#FAFAFA',
|
||||||
violetDark: '#4c2889',
|
violetDark: '#4c2889'
|
||||||
'dark-gray-4': '#2E2E2E',
|
|
||||||
'dark-gray-7': '#8f8f8f',
|
|
||||||
'base-gray-900': '#666666',
|
|
||||||
'light-gray-4': '#EAEAEA',
|
|
||||||
'vercel-blue': '#0C4BE6'
|
|
||||||
},
|
},
|
||||||
keyframes: {
|
keyframes: {
|
||||||
fadeIn: {
|
fadeIn: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user