Skip to content

Commit

Permalink
fix(next-button-active): next button active even when type is not sel…
Browse files Browse the repository at this point in the history
…ected
  • Loading branch information
MahtabBukhari committed Apr 18, 2024
1 parent 72d0e25 commit 4ea08f1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/components/AddItemModal/SetAttributesStep/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import { requiredRule } from '~/constants'
type Props = {
skipToStep: (step: AddItemModalStepID) => void
nodeType: string
handleSelectType: (val: string) => void
}

export const SetAttributesStep: FC<Props> = ({ skipToStep, nodeType }) => {
export const SetAttributesStep: FC<Props> = ({ handleSelectType, skipToStep, nodeType }) => {
const [loading, setLoading] = useState(false)
const [attributes, setAttributes] = useState<parsedObjProps[]>()

Expand Down Expand Up @@ -58,6 +59,11 @@ export const SetAttributesStep: FC<Props> = ({ skipToStep, nodeType }) => {
})
: []

const handlePrevButton = () => {
handleSelectType('')
skipToStep('sourceType')
}

return (
<Flex>
<Flex align="center" direction="row" justify="space-between" mb={18}>
Expand Down Expand Up @@ -94,7 +100,7 @@ export const SetAttributesStep: FC<Props> = ({ skipToStep, nodeType }) => {

<Flex direction="row">
<Flex grow={1}>
<Button color="secondary" onClick={() => skipToStep('sourceType')} size="large" variant="contained">
<Button color="secondary" onClick={handlePrevButton} size="large" variant="contained">
Prev
</Button>
</Flex>
Expand Down
2 changes: 1 addition & 1 deletion src/components/AddItemModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ export const AddItemModal = () => {
source: <SourceStep name={name} skipToStep={skipToStep} sourceLink={sourceLink || ''} type={nodeType} />,
setBudget: <BudgetStep loading={loading} onClick={() => null} />,
createConfirmation: <CreateConfirmation onclose={handleClose} type={type} />,
setAttribues: <SetAttributesStep nodeType={nodeType} skipToStep={skipToStep} />,
setAttribues: <SetAttributesStep handleSelectType={handleSelectType} nodeType={nodeType} skipToStep={skipToStep} />,
}

const modalKind: ModalKind = 'small'
Expand Down

0 comments on commit 4ea08f1

Please sign in to comment.