-
Notifications
You must be signed in to change notification settings - Fork 77
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
2ffa133
commit 0426df3
Showing
20 changed files
with
220 additions
and
123 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,34 @@ | ||
import {BtnFnProps} from '@reactour/tour/dist/types'; | ||
import {PrimaryButton} from 'components/TestResults/TestResults.styled'; | ||
import {Button} from 'antd'; | ||
|
||
export const NextButton: React.FC<BtnFnProps> = ({currentStep, setCurrentStep, stepsLength, setIsOpen}) => { | ||
const isLast = currentStep === stepsLength - 1; | ||
let isFirst = currentStep === 0; | ||
return ( | ||
<PrimaryButton | ||
onClick={() => { | ||
if (isLast) { | ||
setIsOpen(false); | ||
setCurrentStep(0); | ||
return; | ||
} | ||
setCurrentStep(prevState => Number(prevState) + 1); | ||
}} | ||
> | ||
{isLast ? 'Ok' : 'Next'} | ||
</PrimaryButton> | ||
<div> | ||
<Button | ||
type="text" | ||
onClick={() => { | ||
if (!isFirst) { | ||
setCurrentStep(prevState => Number(prevState) - 1); | ||
} | ||
}} | ||
> | ||
Prev | ||
</Button> | ||
<Button | ||
type="text" | ||
onClick={() => { | ||
if (isLast) { | ||
setIsOpen(false); | ||
setCurrentStep(0); | ||
return; | ||
} | ||
setCurrentStep(prevState => Number(prevState) + 1); | ||
}} | ||
> | ||
{isLast ? 'Ok' : 'Next'} | ||
</Button> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
import {BtnFnProps} from '@reactour/tour/dist/types'; | ||
import {Typography} from 'antd'; | ||
import {Button} from 'antd'; | ||
|
||
export const PreviousButton: React.FC<BtnFnProps> = ({currentStep, stepsLength}) => ( | ||
<div> | ||
<Typography.Text>{` ${currentStep + 1} of ${stepsLength}`}</Typography.Text> | ||
</div> | ||
export const PreviousButton: React.FC<BtnFnProps> = ({setIsOpen, setCurrentStep}) => ( | ||
<Button | ||
type="link" | ||
onClick={() => { | ||
setCurrentStep(0); | ||
setIsOpen(false); | ||
}} | ||
> | ||
Skip | ||
</Button> | ||
); |
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,32 +1,42 @@ | ||
import {Divider as AntdDivider, Typography} from 'antd'; | ||
import {Typography, Divider as AntdDivider} from 'antd'; | ||
import styled from 'styled-components'; | ||
|
||
export const Container = styled.div` | ||
min-height: 100px; | ||
padding-top: 12px; | ||
padding-left: 16px; | ||
padding-right: 16px; | ||
`; | ||
export const TitleContainer = styled.div` | ||
display: flex; | ||
justify-content: center; | ||
justify-content: space-between; | ||
align-items: center; | ||
`; | ||
|
||
export const Header = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
padding-left: 16px; | ||
padding-right: 16px; | ||
padding-bottom: 0; | ||
margin-top: 16px; | ||
height: 24px; | ||
padding: 16px; | ||
height: 48px; | ||
background: linear-gradient(180deg, #2f1e61 -11.46%, #bc334a 134.37%); | ||
> div { | ||
width: 100%; | ||
} | ||
`; | ||
export const Divider = styled(AntdDivider)` | ||
margin-top: 12px; | ||
margin-bottom: 12px; | ||
margin-bottom: 0; | ||
`; | ||
|
||
export const TitleText = styled(Typography.Text).attrs({level: 3})` | ||
&& { | ||
color: white; | ||
opacity: 0.6; | ||
} | ||
`; | ||
export const Title = styled(Typography.Title).attrs({level: 3})` | ||
&& { | ||
color: white; | ||
margin-bottom: 0; | ||
} | ||
`; |
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,28 +1,23 @@ | ||
import {CloseOutlined} from '@ant-design/icons'; | ||
import {Button} from 'antd'; | ||
import React, {Dispatch} from 'react'; | ||
import {Container, Divider, Header, Title, TitleContainer} from './StepContent.styled'; | ||
import React from 'react'; | ||
import {Container, Divider, Header, Title, TitleContainer, TitleText} from './StepContent.styled'; | ||
|
||
interface IProps { | ||
title: string; | ||
setIsOpen?: Dispatch<React.SetStateAction<Boolean>>; | ||
stepsLength: number; | ||
currentStep: number; | ||
} | ||
|
||
export const StepContent: React.FC<IProps> = ({setIsOpen, title, children}) => ( | ||
<> | ||
<Header> | ||
<TitleContainer> | ||
<Title>{title}</Title> | ||
</TitleContainer> | ||
<Button | ||
style={{width: 24, height: 24}} | ||
type="link" | ||
icon={<CloseOutlined />} | ||
onClick={() => setIsOpen?.(o => !o)} | ||
/> | ||
</Header> | ||
<Divider /> | ||
<Container>{children}</Container> | ||
<Divider /> | ||
</> | ||
); | ||
export const StepContent: React.FC<IProps> = ({title, children, stepsLength, currentStep}) => { | ||
return ( | ||
<> | ||
<Header> | ||
<TitleContainer> | ||
<Title>{title}</Title> | ||
<TitleText>{` ${currentStep + 1} of ${stepsLength}`}</TitleText> | ||
</TitleContainer> | ||
</Header> | ||
<Container>{children}</Container> | ||
<Divider /> | ||
</> | ||
); | ||
}; |
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
Oops, something went wrong.