Skip to content

Commit 5814a6b

Browse files
committed
Initial commit
1 parent a4c9287 commit 5814a6b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+11166
-203
lines changed

.gitignore

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
12+
13+
# testing
14+
/coverage
15+
16+
# next.js
17+
/.next/
18+
/out/
19+
20+
# production
21+
/build
22+
23+
# misc
24+
.DS_Store
25+
*.pem
26+
27+
# debug
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*
31+
.pnpm-debug.log*
32+
33+
# env files (can opt-in for committing if needed)
34+
.env*
35+
36+
# vercel
37+
.vercel
38+
39+
# typescript
40+
*.tsbuildinfo
41+
next-env.d.ts

LICENSE

-201
This file was deleted.

README.md

+36-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,36 @@
1-
# react_multistep_form
2-
A multi step form Reactive page
1+
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
2+
3+
## Getting Started
4+
5+
First, run the development server:
6+
7+
```bash
8+
npm run dev
9+
# or
10+
yarn dev
11+
# or
12+
pnpm dev
13+
# or
14+
bun dev
15+
```
16+
17+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18+
19+
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20+
21+
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
22+
23+
## Learn More
24+
25+
To learn more about Next.js, take a look at the following resources:
26+
27+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29+
30+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
31+
32+
## Deploy on Vercel
33+
34+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35+
36+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.

app/components/stepper/stepper.tsx

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
"use client";
2+
3+
import React, { useState } from "react";
4+
import { Step } from "./types";
5+
import { IconType } from "react-icons";
6+
7+
export const Stepper = ({
8+
steps,
9+
currentStep,
10+
onChangeStep, //callback function
11+
}: {
12+
steps: Step[];
13+
currentStep: number;
14+
onChangeStep: (stepIndex: number) => void;
15+
}) => {
16+
return (
17+
<div className="flex items-start justify-start p-7 ml-20">
18+
{/* */}
19+
<div className=" border rounded-lg flex justify-center items-center p-2">
20+
{/* steps array */}
21+
{steps.map((step, index) => (
22+
// step wrapper
23+
<div
24+
onClick={() => {
25+
onChangeStep(index);
26+
}}
27+
key={index}
28+
className="flex items-center p-3 gap-2 cursor-pointer "
29+
>
30+
{/* Step Indicator */}
31+
<StepIndicator Icon={step.icon} isActive={currentStep === index} />
32+
33+
{/* Step Label (only shown for the active step) */}
34+
{currentStep === index && (
35+
<StepLabel label={step.label} stepNumber={index + 1} />
36+
)}
37+
</div>
38+
))}
39+
</div>
40+
</div>
41+
);
42+
};
43+
44+
export default Stepper;
45+
46+
function StepLabel({
47+
label,
48+
stepNumber,
49+
}: {
50+
label: string;
51+
stepNumber: number;
52+
}) {
53+
return (
54+
<div className="flex flex-col ">
55+
<span className="text-[13px] font-medium text-primary">
56+
STEP {stepNumber}
57+
</span>
58+
<span className="font-bold">{label}</span>
59+
</div>
60+
);
61+
}
62+
63+
function StepIndicator({
64+
Icon,
65+
isActive,
66+
}: {
67+
Icon: IconType;
68+
isActive: boolean;
69+
}) {
70+
return (
71+
<div
72+
className={` p-3 rounded-full ${
73+
isActive ? "bg-primary/10" : "bg-gray-100"
74+
}`}
75+
>
76+
<Icon className={`${isActive ? "text-primary" : "text-gray-400"}`} />
77+
</div>
78+
);
79+
}

0 commit comments

Comments
 (0)