-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(frontend): add wizard layout and architecture (#3521)
* feat(frontend): add wizard layout and architecture * add home icon * fix cypress tests
- Loading branch information
Showing
25 changed files
with
410 additions
and
70 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
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
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
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
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
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
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
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
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
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
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,17 @@ | ||
import {Typography} from 'antd'; | ||
import styled from 'styled-components'; | ||
|
||
export const Container = styled.div` | ||
padding: 16px; | ||
border-bottom: 1px solid ${({theme}) => theme.color.border}; | ||
`; | ||
|
||
export const Title = styled(Typography.Title)` | ||
&& { | ||
margin-bottom: 12px; | ||
} | ||
`; | ||
|
||
export const Text = styled(Typography.Text)` | ||
font-size: ${({theme}) => theme.size.sm}; | ||
`; |
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,23 @@ | ||
import {Progress} from 'antd'; | ||
import * as S from './Header.styled'; | ||
|
||
function calculatePercent(activeStep: number, totalSteps: number) { | ||
return Math.round((activeStep / totalSteps) * 100); | ||
} | ||
|
||
interface IProps { | ||
activeStep: number; | ||
totalSteps: number; | ||
} | ||
|
||
const Header = ({activeStep, totalSteps}: IProps) => ( | ||
<S.Container> | ||
<S.Title>🚀 Setup guide</S.Title> | ||
<Progress percent={calculatePercent(activeStep, totalSteps)} showInfo={false} /> | ||
<S.Text> | ||
{activeStep} of {totalSteps} steps completed | ||
</S.Text> | ||
</S.Container> | ||
); | ||
|
||
export default Header; |
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,2 @@ | ||
// eslint-disable-next-line no-restricted-exports | ||
export {default} from './Header'; |
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,19 @@ | ||
import {IWizardStep, IWizardStepComponentMap} from 'types/Wizard.types'; | ||
|
||
const StepComponentMap: IWizardStepComponentMap = { | ||
Step1: () => <div>Step 1</div>, | ||
Step2: () => <div>Step 1</div>, | ||
Step3: () => <div>Step 3</div>, | ||
}; | ||
|
||
interface IProps { | ||
step: IWizardStep; | ||
} | ||
|
||
const StepFactory = ({step: {component}}: IProps) => { | ||
const Step = StepComponentMap[component]; | ||
|
||
return <Step />; | ||
}; | ||
|
||
export default StepFactory; |
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,2 @@ | ||
// eslint-disable-next-line no-restricted-exports | ||
export {default} from './StepFactory'; |
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,24 @@ | ||
import {CheckOutlined} from '@ant-design/icons'; | ||
import {IWizardStep} from 'types/Wizard.types'; | ||
import * as S from './Steps.styled'; | ||
|
||
interface IProps { | ||
index: number; | ||
isActive: boolean; | ||
step: IWizardStep; | ||
} | ||
|
||
const StepTab = ({index, isActive, step}: IProps) => ( | ||
<S.StepTabContainer $isActive={isActive}> | ||
{step.status === 'complete' ? ( | ||
<S.StepTabCheck> | ||
<CheckOutlined /> | ||
</S.StepTabCheck> | ||
) : ( | ||
<S.StepTabNumber>{index}</S.StepTabNumber> | ||
)} | ||
<S.StepTabTitle $isActive={isActive}>{step.name}</S.StepTabTitle> | ||
</S.StepTabContainer> | ||
); | ||
|
||
export default StepTab; |
Oops, something went wrong.