Skip to content

Commit

Permalink
refactor(createInfluencer): Add Typescript types (carbon-design-syste…
Browse files Browse the repository at this point in the history
…m#5129)

* refactor(CreateInfluencer): add typescript types

* refactor(CreateInfluencer): update setpdata type

* refactor(createinfluencer): fix build error
  • Loading branch information
sangeethababu9223 authored May 20, 2024
1 parent dd47b17 commit c93cf1f
Showing 1 changed file with 34 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

// Import portions of React that are needed.
import React from 'react';
import React, { PropsWithChildren, ReactNode } from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import { ProgressIndicator, ProgressStep } from '@carbon/react';
Expand All @@ -18,9 +18,39 @@ import { pkg } from '../../settings';
const blockClass = `${pkg.prefix}--create-influencer`;
const componentName = 'CreateInfluencer';

export let CreateInfluencer = ({ className, currentStep, stepData, title }) => {
interface Step {
introStep?: boolean;
secondaryLabel?: string;
shouldIncludeStep?: boolean;
title?: ReactNode;
}
interface CreateInfluencerProps {
/**
* Provide an optional class to be applied to the containing node.
*/
className?: string;
/**
* Provide the current step number.
*/
currentStep: number;
/**
* Provide the Set Data.
*/
stepData: Step[];
/**
* Title.
*/
title?: string | undefined;
}

export const CreateInfluencer = ({
className,
currentStep,
stepData,
title,
}: PropsWithChildren<CreateInfluencerProps>) => {
const getNumberOfDynamicStepsBeforeCurrentStep = (array, key) => {
const dynamicSteps = [];
const dynamicSteps: any[] = [];
array.forEach((item, index) => {
if (array[index]?.[key] === false && index <= currentStep - 1) {
dynamicSteps.push(item);
Expand Down Expand Up @@ -63,7 +93,7 @@ export let CreateInfluencer = ({ className, currentStep, stepData, title }) => {
label={step.title}
key={stepIndex}
secondaryLabel={step.secondaryLabel}
invalid={step.invalid}
invalid={(step as any).invalid}
/>
);
})}
Expand Down

0 comments on commit c93cf1f

Please sign in to comment.