mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
🎨 styles: shipping method
:%s
This commit is contained in:
@@ -8,7 +8,7 @@ interface CheckoutCollapseProps {
|
|||||||
children: React.ReactNode
|
children: React.ReactNode
|
||||||
title: string
|
title: string
|
||||||
isEdit: boolean
|
isEdit: boolean
|
||||||
onClose?: (id: number) => void
|
onClose: (id: number) => void
|
||||||
onOpen?: (id: number) => void
|
onOpen?: (id: number) => void
|
||||||
onEditClick?: (id: number) => void
|
onEditClick?: (id: number) => void
|
||||||
note?: string
|
note?: string
|
||||||
@@ -29,7 +29,7 @@ const CheckoutCollapse = ({
|
|||||||
}: CheckoutCollapseProps) => {
|
}: CheckoutCollapseProps) => {
|
||||||
const handleToggle = () => {
|
const handleToggle = () => {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
onClose && onClose(id)
|
isEdit && onClose(id)
|
||||||
} else if (!disableEdit) {
|
} else if (!disableEdit) {
|
||||||
isEdit && onEditClick && onEditClick(id)
|
isEdit && onEditClick && onEditClick(id)
|
||||||
}
|
}
|
||||||
|
@@ -66,7 +66,7 @@ const FormPromotionCode = () => {
|
|||||||
|
|
||||||
<InputFiledInForm
|
<InputFiledInForm
|
||||||
name="couponCode"
|
name="couponCode"
|
||||||
placeholder="Coupon code"
|
placeholder="Promotion code"
|
||||||
error={
|
error={
|
||||||
touched.couponCode && errors.couponCode
|
touched.couponCode && errors.couponCode
|
||||||
? errors.couponCode.toString()
|
? errors.couponCode.toString()
|
||||||
|
@@ -62,6 +62,7 @@ const ShippingMethod = memo(({ currency, onConfirm }: Props) => {
|
|||||||
name={item.name}
|
name={item.name}
|
||||||
price={item.price}
|
price={item.price}
|
||||||
currency={currency}
|
currency={currency}
|
||||||
|
isActive={selectedValue?.id === item.id}
|
||||||
onSelect={onChange}
|
onSelect={onChange}
|
||||||
/>)}
|
/>)}
|
||||||
</ul>
|
</ul>
|
||||||
|
@@ -1,12 +1,18 @@
|
|||||||
.shippingMethodItem {
|
.shippingMethodItem {
|
||||||
@apply flex justify-between items-center cursor-pointer transition-all duration-200;
|
@apply w-full flex justify-between items-center cursor-pointer transition-all duration-200;
|
||||||
width: 100%;
|
|
||||||
padding: 1.6rem;
|
padding: 1.6rem;
|
||||||
&:hover {
|
&:hover {
|
||||||
@apply bg-gray;
|
@apply bg-gray;
|
||||||
}
|
}
|
||||||
.left {
|
.left {
|
||||||
@apply flex;
|
@apply flex;
|
||||||
|
.icon {
|
||||||
|
@apply transition-all duration-200;
|
||||||
|
opacity: 0;
|
||||||
|
&.show {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
.name {
|
.name {
|
||||||
margin-left: 1.6rem;
|
margin-left: 1.6rem;
|
||||||
color: var(--text-active);
|
color: var(--text-active);
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
|
import classNames from 'classnames'
|
||||||
import React, { memo } from 'react'
|
import React, { memo } from 'react'
|
||||||
|
import { IconCheck } from 'src/components/icons'
|
||||||
import s from './ShippingMethodItem.module.scss'
|
import s from './ShippingMethodItem.module.scss'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -7,16 +9,23 @@ interface Props {
|
|||||||
price: number
|
price: number
|
||||||
currency: string
|
currency: string
|
||||||
onSelect: (id: string) => void
|
onSelect: (id: string) => void
|
||||||
|
isActive: boolean
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ShippingMethodItem = memo(({ id, name, price, currency, onSelect }: Props) => {
|
const ShippingMethodItem = memo(({ id, name, price, currency, isActive, onSelect }: Props) => {
|
||||||
const handleSelect = () => {
|
const handleSelect = () => {
|
||||||
onSelect(id)
|
onSelect(id)
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<li className={s.shippingMethodItem} key={id} onClick={handleSelect}>
|
<li className={s.shippingMethodItem} key={id} onClick={handleSelect}>
|
||||||
<div className={s.name}>
|
<div className={s.left}>
|
||||||
{name}
|
<div className={classNames(s.icon, { [s.show]: isActive })}>
|
||||||
|
<IconCheck />
|
||||||
|
</div>
|
||||||
|
<div className={s.name}>
|
||||||
|
{name}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={s.price}>
|
<div className={s.price}>
|
||||||
{price ? `${price / 100} ${currency}` : "Free"}
|
{price ? `${price / 100} ${currency}` : "Free"}
|
||||||
|
Reference in New Issue
Block a user