Skip to content

Commit

Permalink
file linting
Browse files Browse the repository at this point in the history
  • Loading branch information
HCarrer committed Apr 29, 2024
1 parent 311de4f commit 22a8dfd
Showing 1 changed file with 27 additions and 22 deletions.
49 changes: 27 additions & 22 deletions styleguide/src/Navigation/Stepper/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import React from 'react'

export const Stepper: React.FC<StepperProps> = React.memo(
({
className = '',
currentStep = 0,
steps = [],
showText = false,
}) => {
({ className = '', currentStep = 0, steps = [], showText = false }) => {
const getColors = (step: number) => {
if(currentStep > step) return 'bg-primary border-primary'
if(currentStep == step) return 'bg-inverted-1 border-inverted-1'
if (currentStep > step) return 'bg-primary border-primary'
if (currentStep === step) return 'bg-inverted-1 border-inverted-1'
return 'bg-base-4 border-base-4'
}

return(
return (
<div
className={`w-full flex flex-row justify-center gap-x-10 mb-6 relative ${className}`}
id="stepsContainer"
Expand All @@ -26,18 +20,24 @@ export const Stepper: React.FC<StepperProps> = React.memo(
className="flex flex-row items-center gap-y-2.5 gap-x-3.5 z-10 relative"
>
{!showText && index > 0 && (
<div id={`leftLinkStep${item.step}`} className={`w-5 h-0.5 absolute -left-5 ${currentStep >= item.step ? 'bg-primary' : 'bg-base-4'}`}/>)
}
<div
id={`leftLinkStep${item.step}`}
className={`w-5 h-0.5 absolute -left-5 ${
currentStep >= item.step ? 'bg-primary' : 'bg-base-4'
}`}
/>
)}
<div
id={`stepCircle${item.step}`}
className={`flex w-8 h-8 rounded-full border-2 justify-center items-center text-base-1
${getColors(item.step)}
${item.customClassName}`
}
${item.customClassName}`}
>
<span
onClick={() => item.handleClick?.()}
className={`font-bold ${item.handleClick ? 'cursor-pointer' : ''}`}
className={`font-bold ${
item.handleClick ? 'cursor-pointer' : ''
}`}
>
{item.step}
</span>
Expand All @@ -47,14 +47,19 @@ export const Stepper: React.FC<StepperProps> = React.memo(
onClick={() => item.handleClick?.()}
className={`text-center my-auto text-sm ${showText ? '' : ''}
${item.step < 2 ? 'cursor-pointer' : ''}
${currentStep == item.step ? 'font-bold' : ''}`}
>
${currentStep === item.step ? 'font-bold' : ''}`}
>
{item.text}
</span>
)}
{!showText && index < steps.length - 1 && (
<div id={`rightLinkStep${item.step}`} className={`w-5 h-0.5 absolute -right-5 ${currentStep > item.step ? 'bg-primary' : 'bg-base-4'}`}/>)
}
<div
id={`rightLinkStep${item.step}`}
className={`w-5 h-0.5 absolute -right-5 ${
currentStep > item.step ? 'bg-primary' : 'bg-base-4'
}`}
/>
)}
</div>
)
})}
Expand All @@ -64,9 +69,9 @@ export const Stepper: React.FC<StepperProps> = React.memo(
)

type StepType = {
step: number,
text?: string,
handleClick?: Function,
step: number
text?: string
handleClick?: Function
customClassName?: string
}

Expand Down

0 comments on commit 22a8dfd

Please sign in to comment.