parent
a4954ac63e
commit
8a664b621d
3 changed files with 89 additions and 3 deletions
@ -0,0 +1,83 @@ |
||||
import React, {useState} from "react"; |
||||
|
||||
function Stepper({ |
||||
direction, |
||||
activeColor, |
||||
deactiveColor, |
||||
count, |
||||
currentStep, |
||||
}) { |
||||
const steps = [ |
||||
{ |
||||
title: 'اطلاعات هویتی' |
||||
}, |
||||
{ |
||||
title: 'مشخصات والدین' |
||||
}, |
||||
{ |
||||
title: 'قوانین و مقررات' |
||||
}, |
||||
{ |
||||
title: 'تایید اطلاعات' |
||||
}, |
||||
] |
||||
return ( |
||||
<div |
||||
className={`flex items-center ${ |
||||
direction === "horizontal" ? "flex-row" : "flex-col" |
||||
}`}
|
||||
> |
||||
{steps.map((item, index) => ( |
||||
<div |
||||
className={`flex items-center w-full justify-start relative ${ |
||||
direction === "horizontal" ? "flex-row" : "flex-col" |
||||
}`}
|
||||
> |
||||
<div className="flex items-center justify-start w-full"> |
||||
<div |
||||
className="w-8 h-8 text-white text-sm rounded-full flex justify-center items-center" |
||||
style={{ |
||||
backgroundColor: |
||||
currentStep === Number(index) ? activeColor : deactiveColor, |
||||
}} |
||||
> |
||||
|
||||
</div> |
||||
<p className={`mr-4 font-bold ${currentStep === Number(index) ? 'text-red26' : 'text-gray-400'}`}>{item.title}</p> |
||||
</div> |
||||
{count !== (Number(index) + 1) && ( |
||||
<span |
||||
className={`transform my-1 rounded-xl ${ |
||||
direction === "horizontal" |
||||
? "w-8 h-1" |
||||
: "h-8 w-1" |
||||
}`}
|
||||
style={{ |
||||
opacity: '0.5', |
||||
background: currentStep === Number(index) ? activeColor : deactiveColor, |
||||
// borderTop: direction === "horizontal" ? `3px solid ${
|
||||
// currentStep === Number(index) ? activeColor : deactiveColor
|
||||
// }` : '',
|
||||
// borderRight: direction === "vertical" ? `3px solid ${
|
||||
// currentStep === Number(index) ? activeColor : deactiveColor
|
||||
// }` : '',
|
||||
transform : `${direction === "horizontal" ? 'translateY(1px)' : 'translateX(64px)'}` |
||||
}} |
||||
></span> |
||||
)} |
||||
</div> |
||||
))} |
||||
</div> |
||||
); |
||||
} |
||||
|
||||
|
||||
export default Stepper; |
||||
|
||||
Stepper.defaultProps = { |
||||
direction: "vertical", |
||||
activeColor: "#df1452", |
||||
deactiveColor: "#DBDBDB", |
||||
|
||||
|
||||
}; |
Loading…
Reference in new issue