diff --git a/src/plays/steps/App.tsx b/src/plays/steps/App.tsx new file mode 100644 index 000000000..192c4e3ab --- /dev/null +++ b/src/plays/steps/App.tsx @@ -0,0 +1,9 @@ +import React from 'react'; + +import StepsWrapper from './components/StepsWrapper'; + +const App = () => { + return ; +}; + +export default App; diff --git a/src/plays/steps/Readme.md b/src/plays/steps/Readme.md new file mode 100644 index 000000000..2b14a4ddd --- /dev/null +++ b/src/plays/steps/Readme.md @@ -0,0 +1,27 @@ +# Steps + +A web app with “next” and “previous” navigation buttons, where the “next” button helps users move forward through steps, similar to the flow in e-commerce applications, and the “previous” button allows them to step back. + +## Play Demographic + +- Language: ts +- Level: Beginner + +## Creator Information + +- User: aaqib605 +- Gihub Link: https://github.com/aaqib605 +- Blog: https://hashnode.com/@aaqib605 +- Video: + +## Implementation Details + +Update your implementation idea and details here + +## Consideration + +Update all considerations(if any) + +## Resources + +Update external resources(if any) diff --git a/src/plays/steps/Steps.tsx b/src/plays/steps/Steps.tsx new file mode 100644 index 000000000..29a587e71 --- /dev/null +++ b/src/plays/steps/Steps.tsx @@ -0,0 +1,20 @@ +import React from 'react'; + +import PlayHeader from 'common/playlists/PlayHeader'; +import App from './App'; +import './styles.css'; + +function Steps(props: any) { + return ( + <> +
+ +
+ +
+
+ + ); +} + +export default Steps; diff --git a/src/plays/steps/components/Button.tsx b/src/plays/steps/components/Button.tsx new file mode 100644 index 000000000..78df4e145 --- /dev/null +++ b/src/plays/steps/components/Button.tsx @@ -0,0 +1,22 @@ +import React, { ReactNode, MouseEventHandler } from 'react'; + +interface ButtonProps { + bgColor: string; + textColor: string; + disable: boolean; + onClick: MouseEventHandler; + children: ReactNode; +} + +export default function Button({ textColor, bgColor, onClick, disable, children }: ButtonProps) { + const disabledStyles = { background: 'grey', color: 'white', cursor: 'not-allowed' }; + + return ( + + ); +} diff --git a/src/plays/steps/components/StepMessage.tsx b/src/plays/steps/components/StepMessage.tsx new file mode 100644 index 000000000..603eee517 --- /dev/null +++ b/src/plays/steps/components/StepMessage.tsx @@ -0,0 +1,15 @@ +import React from 'react'; + +interface StepMessageProps { + step: number; + children: React.ReactNode; +} + +export default function StepMessage({ step, children }: StepMessageProps) { + return ( +
+

Step {step}

+ {children} +
+ ); +} diff --git a/src/plays/steps/components/StepsWrapper.tsx b/src/plays/steps/components/StepsWrapper.tsx new file mode 100644 index 000000000..e3a50a488 --- /dev/null +++ b/src/plays/steps/components/StepsWrapper.tsx @@ -0,0 +1,44 @@ +import React, { useState } from 'react'; + +import StepMessage from './StepMessage'; +import Button from './Button'; + +export default function StepsWrapper() { + const [step, setStep] = useState(1); + + const messages = ['Learn React ⚛️', 'Apply for jobs 💼', 'Invest your new income 🤑']; + + function handlePrevious() { + if (step > 1) setStep((s) => s - 1); + } + + function handleNext() { + if (step < 3) { + setStep((s) => s + 1); + } + } + + return ( +
+
+
+
= 1 ? 'steps_active' : ''}>1
+
= 2 ? 'steps_active' : ''}>2
+
= 3 ? 'steps_active' : ''}>3
+
+ + {messages[step - 1]} + +
+ + + +
+
+
+ ); +} diff --git a/src/plays/steps/cover.png b/src/plays/steps/cover.png new file mode 100644 index 000000000..87586af27 Binary files /dev/null and b/src/plays/steps/cover.png differ diff --git a/src/plays/steps/styles.css b/src/plays/steps/styles.css new file mode 100644 index 000000000..4665c21f9 --- /dev/null +++ b/src/plays/steps/styles.css @@ -0,0 +1,69 @@ +.steps { + width: 600px; + background-color: #f7f7f7; + border-radius: 7px; + padding: 25px 100px; + margin: 100px auto; +} + +.steps_numbers { + display: flex; + justify-content: space-between; +} + +.steps_numbers > div { + height: 40px; + aspect-ratio: 1; + background-color: #e7e7e7; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + font-size: 18px; +} + +.steps_numbers .steps_active { + background-color: #7950f2; + color: #fff; +} + +.steps_message { + text-align: center; + font-size: 20px; + margin: 40px 0; + font-weight: bold; + + display: flex; + flex-direction: column; + align-items: center; +} + +.steps_buttons { + display: flex; + justify-content: space-between; +} + +.steps_buttons button { + border: none; + cursor: pointer; + padding: 10px 15px; + border-radius: 100px; + font-size: 14px; + font-weight: bold; + + display: flex; + align-items: center; + justify-content: center; + gap: 10px; + min-width: 8rem; +} + +.steps_buttons button span { + font-size: 16px; + line-height: 1; +} + +.steps_message h3 { + margin: 0; + text-transform: uppercase; +}