Files
fabric_trade_user/src/components/layout/CheckoutStepper.vue
T

142 lines
3.1 KiB
Vue

<script setup lang="ts">
defineProps<{
currentStep: 1 | 2 | 3 | 4
}>()
const steps = [
{ num: 1, label: 'سبد خرید' },
{ num: 2, label: 'انتخاب تسویه' },
{ num: 3, label: 'ثبت اطلاعات' },
{ num: 4, label: 'تأیید نهایی' },
]
</script>
<template>
<nav class="checkout-stepper" aria-label="مراحل تسویه">
<template v-for="(step, index) in steps" :key="step.num">
<div
class="checkout-stepper__item"
:class="{
'checkout-stepper__item--done': step.num < currentStep,
'checkout-stepper__item--active': step.num === currentStep,
}"
>
<span class="checkout-stepper__dot">
<span v-if="step.num < currentStep" class="checkout-stepper__check">✓</span>
<template v-else>{{ step.num }}</template>
</span>
<span class="checkout-stepper__label">{{ step.label }}</span>
</div>
<div
v-if="index < steps.length - 1"
class="checkout-stepper__bridge"
aria-hidden="true"
>
<span
class="checkout-stepper__bridge-line"
:class="{ 'checkout-stepper__bridge-line--done': index < currentStep }"
/>
</div>
</template>
</nav>
</template>
<style scoped>
.checkout-stepper {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: flex-start;
direction: rtl;
gap: 0;
width: 100%;
padding: 22px 28px 20px;
margin-bottom: 24px;
background: var(--color-surface);
border-radius: var(--radius-lg);
border: 1px solid var(--color-border);
box-shadow: var(--shadow-card);
}
.checkout-stepper__item {
flex: 0 0 auto;
display: flex;
flex-direction: column;
align-items: center;
gap: 10px;
min-width: 88px;
text-align: center;
}
.checkout-stepper__bridge {
flex: 1 1 0;
min-width: 20px;
height: 32px;
display: flex;
align-items: center;
padding: 0 4px;
}
.checkout-stepper__bridge-line {
display: block;
width: 100%;
height: 2px;
background: #e2e8f0;
border-radius: 1px;
}
.checkout-stepper__bridge-line--done {
background: var(--color-primary);
}
.checkout-stepper__dot {
width: 32px;
height: 32px;
border-radius: 50%;
border: 2px solid #e2e8f0;
background: var(--color-surface);
color: #94a3b8;
font-size: 0.875rem;
font-weight: 700;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.checkout-stepper__item--done .checkout-stepper__dot {
background: var(--color-primary);
border-color: var(--color-primary);
color: #fff;
}
.checkout-stepper__item--active .checkout-stepper__dot {
background: var(--color-primary);
border-color: var(--color-primary);
color: #fff;
}
.checkout-stepper__check {
font-size: 0.8125rem;
line-height: 1;
}
.checkout-stepper__label {
font-size: 0.8125rem;
font-weight: 500;
color: #94a3b8;
line-height: 1.35;
white-space: nowrap;
}
.checkout-stepper__item--active .checkout-stepper__label {
color: var(--color-primary);
font-weight: 700;
}
.checkout-stepper__item--done .checkout-stepper__label {
color: var(--color-text);
font-weight: 600;
}
</style>