Skip to content

Commit 29abdc6

Browse files
feat(firstMile): make subway navigation links clickable (#4186)
1 parent 9f0c4da commit 29abdc6

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

src/homepageExperience/components/HomepageExperience.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ $pool-fill: #00a3ff;
6363
}
6464

6565
.subway-navigation-step-flex-wrapper {
66+
cursor: pointer;
6667
display: flex;
6768
flex-direction: column;
6869

src/homepageExperience/components/Navigation.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ import {HOMEPAGE_NAVIGATION_STEPS} from 'src/homepageExperience/utils'
99

1010
interface OwnProps {
1111
currentStep: number
12+
onClick: (number) => void
1213
}
1314

1415
export class Navigation extends PureComponent<OwnProps> {
16+
handleClick = (step: number) => {
17+
this.props.onClick(step)
18+
}
19+
1520
render() {
1621
return (
1722
<div className="subway-navigation-container">
@@ -29,11 +34,14 @@ export class Navigation extends PureComponent<OwnProps> {
2934
</div>
3035
{HOMEPAGE_NAVIGATION_STEPS.map((value, index) => (
3136
<Step
37+
icon={value.icon}
38+
key={value.name}
39+
onClick={() => {
40+
this.handleClick(index + 1)
41+
}}
3242
stepIsActive={index === this.props.currentStep - 1}
3343
stepIsComplete={index < this.props.currentStep - 1}
34-
icon={value.icon}
3544
text={value.name}
36-
key={index}
3745
/>
3846
))}
3947
</div>

src/homepageExperience/components/steps/Step.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ import {InfluxColors} from '@influxdata/clockface'
66
import {StepCompleteIcon} from 'src/homepageExperience/components/HomepageIcons'
77

88
type StepProps = {
9+
icon: JSX.Element
10+
onClick: () => void
911
stepIsActive: boolean
1012
stepIsComplete: boolean
11-
icon: JSX.Element
1213
text: string
1314
}
1415

1516
const Step = (props: StepProps) => {
16-
const {text, icon, stepIsActive, stepIsComplete} = props
17+
const {icon, onClick, stepIsActive, stepIsComplete, text} = props
1718
const iconAndTextColor =
1819
stepIsActive || stepIsComplete ? InfluxColors.Pool : InfluxColors.Grey95
1920

@@ -22,6 +23,7 @@ const Step = (props: StepProps) => {
2223
className={classnames('subway-navigation-step-flex-wrapper', {
2324
stepIsComplete: stepIsComplete,
2425
})}
26+
onClick={onClick}
2527
>
2628
<div
2729
className={classnames('subway-navigation-step', {

src/homepageExperience/containers/HomepagePythonWizard.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ export class HomepagePythonWizard extends PureComponent<null, State> {
3434
selectedBucket: '',
3535
}
3636

37+
private handleSelectBucket = (bucketName: string) => {
38+
this.setState({selectedBucket: bucketName})
39+
}
40+
3741
handleNextClick = () => {
3842
this.setState(
3943
{
@@ -57,9 +61,10 @@ export class HomepagePythonWizard extends PureComponent<null, State> {
5761
)
5862
}
5963

60-
private handleSelectBucket = (bucketName: string) => {
61-
this.setState({selectedBucket: bucketName})
64+
handleNavClick = (clickedStep: number) => {
65+
this.setState({currentStep: clickedStep})
6266
}
67+
6368
renderStep = () => {
6469
switch (this.state.currentStep) {
6570
case 1: {
@@ -99,7 +104,10 @@ export class HomepagePythonWizard extends PureComponent<null, State> {
99104
<div className="homepage-wizard-container">
100105
<aside className="homepage-wizard-container--subway">
101106
<div style={{width: '100%'}}>
102-
<Navigation currentStep={this.state.currentStep} />
107+
<Navigation
108+
currentStep={this.state.currentStep}
109+
onClick={this.handleNavClick}
110+
/>
103111
</div>
104112
</aside>
105113
<div className="homepage-wizard-container--main">

0 commit comments

Comments
 (0)