-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
032ecd4
commit 8fec920
Showing
4 changed files
with
48 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
.../components/AddBrainModal/components/AddBrainSteps/components/Stepper/components/Step.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { FaCheckCircle } from "react-icons/fa"; | ||
|
||
import { cn } from "@/lib/utils"; | ||
|
||
import { useBrainCreationSteps } from "../../../hooks/useBrainCreationSteps"; | ||
import { Step as StepType } from "../../../types"; | ||
|
||
type StepProps = { | ||
index: number; | ||
step: StepType; | ||
}; | ||
|
||
export const Step = ({ index, step }: StepProps): JSX.Element => { | ||
const { currentStep, currentStepIndex } = useBrainCreationSteps(); | ||
const isStepDone = index < currentStepIndex; | ||
const stepContent = isStepDone ? <FaCheckCircle /> : index + 1; | ||
|
||
return ( | ||
<div | ||
key={step.label} | ||
className="flex flex-row justify-center items-center flex-1" | ||
> | ||
<div className="flex flex-col justify-center items-center"> | ||
<div | ||
className={cn( | ||
"h-[40px] w-[40px] border-solid rounded-full flex flex-row items-center justify-center mb-2 border-primary border-2 text-primary", | ||
isStepDone ? "bg-primary text-white" : "", | ||
step.value === currentStep ? "bg-primary text-white" : "" | ||
)} | ||
> | ||
{stepContent} | ||
</div> | ||
<span key={step.label} className="text-xs text-center"> | ||
{step.label} | ||
</span> | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
frontend/lib/components/AddBrainModal/components/AddBrainSteps/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { BrainCreationStep } from "../../types"; | ||
|
||
export type StepperStep = { | ||
export type Step = { | ||
label: string; | ||
value: BrainCreationStep; | ||
}; |