Place wizard types in appropriate files
Co-authored-by: Daniel Campbell <metalwhirlwind@gmail.com> Co-authored-by: Deniz Kusefoglu <deniz@influxdata.com>generic-wizard
parent
0e22181190
commit
01f00724b6
|
@ -1,26 +1,7 @@
|
||||||
import React, {PureComponent, ReactElement, ReactNode} from 'react'
|
import React, {PureComponent, ReactElement} from 'react'
|
||||||
import WizardProgressBar from 'src/reusable_ui/components/wizard/WizardProgressBar'
|
import WizardProgressBar from 'src/reusable_ui/components/wizard/WizardProgressBar'
|
||||||
|
|
||||||
interface WizardStepProps {
|
import {WizardStepProps, StepStatus, Step} from 'src/types/wizard'
|
||||||
children: ReactNode
|
|
||||||
title: string
|
|
||||||
isComplete: () => boolean
|
|
||||||
onPrevious: () => void
|
|
||||||
onNext: () => void
|
|
||||||
increment?: () => void
|
|
||||||
decrement?: () => void
|
|
||||||
}
|
|
||||||
|
|
||||||
enum StepStatus {
|
|
||||||
Incomplete = 'circle-thick',
|
|
||||||
Complete = 'checkmark',
|
|
||||||
Error = 'remove',
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Step {
|
|
||||||
title: string
|
|
||||||
stepStatus: StepStatus
|
|
||||||
}
|
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
steps: Step[]
|
steps: Step[]
|
||||||
|
|
|
@ -1,19 +1,11 @@
|
||||||
import React, {PureComponent, ReactElement, ReactNode} from 'react'
|
import React, {PureComponent, ReactElement} from 'react'
|
||||||
import OverlayBody from 'src/reusable_ui/components/overlays/OverlayBody'
|
import OverlayBody from 'src/reusable_ui/components/overlays/OverlayBody'
|
||||||
import OverlayContainer from 'src/reusable_ui/components/overlays/OverlayContainer'
|
import OverlayContainer from 'src/reusable_ui/components/overlays/OverlayContainer'
|
||||||
import OverlayTechnology from 'src/reusable_ui/components/overlays/OverlayTechnology'
|
import OverlayTechnology from 'src/reusable_ui/components/overlays/OverlayTechnology'
|
||||||
import WizardCloak from 'src/reusable_ui/components/wizard/WizardCloak'
|
import WizardCloak from 'src/reusable_ui/components/wizard/WizardCloak'
|
||||||
import OverlayHeading from 'src/reusable_ui/components/overlays/OverlayHeading'
|
import OverlayHeading from 'src/reusable_ui/components/overlays/OverlayHeading'
|
||||||
interface WizardStepProps {
|
|
||||||
children: ReactNode
|
import {WizardStepProps} from 'src/types/wizard'
|
||||||
title: string
|
|
||||||
isComplete: () => boolean
|
|
||||||
onPrevious: () => void
|
|
||||||
onNext: () => void
|
|
||||||
increment?: () => void
|
|
||||||
decrement?: () => void
|
|
||||||
}
|
|
||||||
// import {} from 'src/types'
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
children: Array<ReactElement<WizardStepProps>>
|
children: Array<ReactElement<WizardStepProps>>
|
||||||
|
|
|
@ -1,27 +1,10 @@
|
||||||
import React, {PureComponent} from 'react'
|
import React, {PureComponent} from 'react'
|
||||||
import ProgressConnector from 'src/reusable_ui/components/wizard/ProgressConnector'
|
import ProgressConnector from 'src/reusable_ui/components/wizard/ProgressConnector'
|
||||||
|
|
||||||
|
import {Step, connectorState, StepStatus} from 'src/types/wizard'
|
||||||
|
|
||||||
import 'src/reusable_ui/components/wizard/WizardProgressBar.scss'
|
import 'src/reusable_ui/components/wizard/WizardProgressBar.scss'
|
||||||
|
|
||||||
// import {} from 'src/types'
|
|
||||||
|
|
||||||
enum statusStates {
|
|
||||||
None = 'none',
|
|
||||||
Some = 'some',
|
|
||||||
Full = 'full',
|
|
||||||
}
|
|
||||||
|
|
||||||
enum StepStatus {
|
|
||||||
Incomplete = 'circle-thick',
|
|
||||||
Complete = 'checkmark',
|
|
||||||
Error = 'remove',
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Step {
|
|
||||||
title: string
|
|
||||||
stepStatus: StepStatus
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
steps: Step[]
|
steps: Step[]
|
||||||
currentStepIndex: number
|
currentStepIndex: number
|
||||||
|
@ -53,10 +36,10 @@ class WizardProgressBar extends PureComponent<Props> {
|
||||||
// CONNECTION ELE
|
// CONNECTION ELE
|
||||||
let connectorStatus
|
let connectorStatus
|
||||||
if (i > 0 && steps[i - 1].stepStatus === StepStatus.Complete) {
|
if (i > 0 && steps[i - 1].stepStatus === StepStatus.Complete) {
|
||||||
connectorStatus = statusStates.Some
|
connectorStatus = connectorState.Some
|
||||||
|
|
||||||
if (stepStatus === StepStatus.Complete) {
|
if (stepStatus === StepStatus.Complete) {
|
||||||
connectorStatus = statusStates.Full
|
connectorStatus = connectorState.Full
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,6 @@ import React, {PureComponent, ReactNode} from 'react'
|
||||||
|
|
||||||
import 'src/reusable_ui/components/wizard/WizardStep.scss'
|
import 'src/reusable_ui/components/wizard/WizardStep.scss'
|
||||||
|
|
||||||
// import {} from 'src/types'
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
children: ReactNode
|
children: ReactNode
|
||||||
title: string
|
title: string
|
||||||
|
|
|
@ -2,8 +2,6 @@ import React, {PureComponent} from 'react'
|
||||||
import WizardOverlay from 'src/reusable_ui/components/wizard/WizardOverlay'
|
import WizardOverlay from 'src/reusable_ui/components/wizard/WizardOverlay'
|
||||||
import WizardStep from 'src/reusable_ui/components/wizard/WizardStep'
|
import WizardStep from 'src/reusable_ui/components/wizard/WizardStep'
|
||||||
|
|
||||||
// import {} from 'src/types'
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
wizardVisibility: boolean
|
wizardVisibility: boolean
|
||||||
toggleVisibility: (isVisible: boolean) => () => void
|
toggleVisibility: (isVisible: boolean) => () => void
|
||||||
|
@ -13,7 +11,7 @@ interface State {
|
||||||
completion: object
|
completion: object
|
||||||
}
|
}
|
||||||
|
|
||||||
class WizardWithSteps extends PureComponent<Props, State> {
|
class GrandWizard extends PureComponent<Props, State> {
|
||||||
constructor(props: Props) {
|
constructor(props: Props) {
|
||||||
super(props)
|
super(props)
|
||||||
this.state = {
|
this.state = {
|
||||||
|
@ -108,4 +106,4 @@ class WizardWithSteps extends PureComponent<Props, State> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default WizardWithSteps
|
export default GrandWizard
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
import {ReactNode} from 'react'
|
||||||
|
|
||||||
|
export interface WizardStepProps {
|
||||||
|
children: ReactNode
|
||||||
|
title: string
|
||||||
|
isComplete: () => boolean
|
||||||
|
onPrevious: () => void
|
||||||
|
onNext: () => void
|
||||||
|
increment?: () => void
|
||||||
|
decrement?: () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum connectorState {
|
||||||
|
None = 'none',
|
||||||
|
Some = 'some',
|
||||||
|
Full = 'full',
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum StepStatus {
|
||||||
|
Incomplete = 'circle-thick',
|
||||||
|
Complete = 'checkmark',
|
||||||
|
Error = 'remove',
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Step {
|
||||||
|
title: string
|
||||||
|
stepStatus: StepStatus
|
||||||
|
}
|
Loading…
Reference in New Issue