-
-
Notifications
You must be signed in to change notification settings - Fork 934
feat: add steps play #1572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: add steps play #1572
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,9 @@ | ||
| import React from 'react'; | ||
|
|
||
| import StepsWrapper from './components/StepsWrapper'; | ||
|
|
||
| const App = () => { | ||
| return <StepsWrapper />; | ||
| }; | ||
|
|
||
| export default App; |
This file contains hidden or 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,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) |
This file contains hidden or 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,20 @@ | ||
| import React from 'react'; | ||
|
|
||
| import PlayHeader from 'common/playlists/PlayHeader'; | ||
| import App from './App'; | ||
| import './styles.css'; | ||
|
|
||
| function Steps(props: any) { | ||
| return ( | ||
| <> | ||
| <div className="play-details"> | ||
| <PlayHeader play={props} /> | ||
| <div className="play-details-body"> | ||
| <App /> | ||
| </div> | ||
| </div> | ||
| </> | ||
| ); | ||
| } | ||
|
|
||
| export default Steps; |
This file contains hidden or 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,22 @@ | ||
| import React, { ReactNode, MouseEventHandler } from 'react'; | ||
|
|
||
| interface ButtonProps { | ||
| bgColor: string; | ||
| textColor: string; | ||
| disable: boolean; | ||
| onClick: MouseEventHandler<HTMLButtonElement>; | ||
| children: ReactNode; | ||
| } | ||
|
|
||
| export default function Button({ textColor, bgColor, onClick, disable, children }: ButtonProps) { | ||
| const disabledStyles = { background: 'grey', color: 'white', cursor: 'not-allowed' }; | ||
|
|
||
| return ( | ||
| <button | ||
| style={disable ? disabledStyles : { backgroundColor: bgColor, color: textColor }} | ||
| onClick={onClick} | ||
| > | ||
| {children} | ||
| </button> | ||
| ); | ||
| } |
This file contains hidden or 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,15 @@ | ||
| import React from 'react'; | ||
|
|
||
| interface StepMessageProps { | ||
| step: number; | ||
| children: React.ReactNode; | ||
| } | ||
|
|
||
| export default function StepMessage({ step, children }: StepMessageProps) { | ||
| return ( | ||
| <div className="steps_message"> | ||
| <h3>Step {step}</h3> | ||
| {children} | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or 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,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 ( | ||
| <div> | ||
| <div className="steps"> | ||
| <div className="steps_numbers"> | ||
| <div className={step >= 1 ? 'steps_active' : ''}>1</div> | ||
| <div className={step >= 2 ? 'steps_active' : ''}>2</div> | ||
| <div className={step >= 3 ? 'steps_active' : ''}>3</div> | ||
| </div> | ||
|
|
||
| <StepMessage step={step}>{messages[step - 1]}</StepMessage> | ||
|
|
||
| <div className="steps_buttons"> | ||
| <Button bgColor="#7950f2" disable={step === 1} textColor="#fff" onClick={handlePrevious}> | ||
| <span>👈</span> Previous | ||
| </Button> | ||
|
|
||
| <Button bgColor="#7950f2" disable={step === 3} textColor="#fff" onClick={handleNext}> | ||
| Next <span>👉</span> | ||
| </Button> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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,73 @@ | ||
| * { | ||
| box-sizing: border-box; | ||
| } | ||
|
|
||
| .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; | ||
| } | ||
|
|
||
| h3 { | ||
priyankarpal marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| margin: 0; | ||
| text-transform: uppercase; | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.