Files
nebula.js/commands/serve/web/components/Hub/ConnectionSteps.jsx
Ahmad Mirzaei 1c8dd28078 test: nebula web - part 01 (#1004)
* test: base test renderer

* test: `<ConnectionStep />`

* test: `<AppList /> tests`

* test: `<ConnectionGuid />`

* test: `<HubLayout />`

* test: `<ConnectionHistory />`

* test: `<ConnectionOptions />` done

* test: `<Error />` done

* test: `<SelectEngine />` done
2022-11-14 13:55:04 +01:00

36 lines
1.0 KiB
JavaScript

import React from 'react';
import Step from '@mui/material/Step';
import { useNavigate } from 'react-router-dom';
import { ThemeWrapper } from '../ThemeWrapper';
import { StepperWrapper, CustomStepLabel } from './styles';
import { steps } from '../../constants/connectionSteps';
import { useRootContext } from '../../contexts/RootContext';
const ConnectionSteps = () => {
const navigate = useNavigate();
const { activeStep, glob, error, setError } = useRootContext();
const handleStepperClick = () => {
if (!(glob || error)) return;
setError();
navigate('/');
};
return (
<ThemeWrapper themeName="dark">
<StepperWrapper alternativeLabel activeStep={activeStep}>
{steps.map((label, i) => (
<Step key={label}>
<CustomStepLabel onClick={handleStepperClick} shouldBePointer={glob || error} error={!!error && !i}>
{label}
</CustomStepLabel>
</Step>
))}
</StepperWrapper>
</ThemeWrapper>
);
};
export default ConnectionSteps;