🎨 styles: shipping method

:%s
This commit is contained in:
lytrankieio123
2021-10-21 10:53:14 +07:00
parent 93ddecbd0f
commit 471d4e1aaf
5 changed files with 24 additions and 8 deletions

View File

@@ -8,7 +8,7 @@ interface CheckoutCollapseProps {
children: React.ReactNode
title: string
isEdit: boolean
onClose?: (id: number) => void
onClose: (id: number) => void
onOpen?: (id: number) => void
onEditClick?: (id: number) => void
note?: string
@@ -29,7 +29,7 @@ const CheckoutCollapse = ({
}: CheckoutCollapseProps) => {
const handleToggle = () => {
if (visible) {
onClose && onClose(id)
isEdit && onClose(id)
} else if (!disableEdit) {
isEdit && onEditClick && onEditClick(id)
}

View File

@@ -66,7 +66,7 @@ const FormPromotionCode = () => {
<InputFiledInForm
name="couponCode"
placeholder="Coupon code"
placeholder="Promotion code"
error={
touched.couponCode && errors.couponCode
? errors.couponCode.toString()

View File

@@ -62,6 +62,7 @@ const ShippingMethod = memo(({ currency, onConfirm }: Props) => {
name={item.name}
price={item.price}
currency={currency}
isActive={selectedValue?.id === item.id}
onSelect={onChange}
/>)}
</ul>

View File

@@ -1,12 +1,18 @@
.shippingMethodItem {
@apply flex justify-between items-center cursor-pointer transition-all duration-200;
width: 100%;
@apply w-full flex justify-between items-center cursor-pointer transition-all duration-200;
padding: 1.6rem;
&:hover {
@apply bg-gray;
}
.left {
@apply flex;
.icon {
@apply transition-all duration-200;
opacity: 0;
&.show {
opacity: 1;
}
}
.name {
margin-left: 1.6rem;
color: var(--text-active);

View File

@@ -1,4 +1,6 @@
import classNames from 'classnames'
import React, { memo } from 'react'
import { IconCheck } from 'src/components/icons'
import s from './ShippingMethodItem.module.scss'
interface Props {
@@ -7,16 +9,23 @@ interface Props {
price: number
currency: string
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 = () => {
onSelect(id)
}
return (
<li className={s.shippingMethodItem} key={id} onClick={handleSelect}>
<div className={s.name}>
{name}
<div className={s.left}>
<div className={classNames(s.icon, { [s.show]: isActive })}>
<IconCheck />
</div>
<div className={s.name}>
{name}
</div>
</div>
<div className={s.price}>
{price ? `${price / 100} ${currency}` : "Free"}