diff --git a/src/products/components/ProductVariantCreateDialog/ProductVariantCreateContent.tsx b/src/products/components/ProductVariantCreateDialog/ProductVariantCreateContent.tsx index 01944bf5c..8e5462237 100644 --- a/src/products/components/ProductVariantCreateDialog/ProductVariantCreateContent.tsx +++ b/src/products/components/ProductVariantCreateDialog/ProductVariantCreateContent.tsx @@ -32,6 +32,7 @@ export interface ProductVariantCreateContentProps { dispatchFormDataAction: React.Dispatch; errors: ProductVariantBulkCreate_productVariantBulkCreate_bulkProductErrors[]; step: ProductVariantCreateStep; + onStepClick: (step: ProductVariantCreateStep) => void; } const ProductVariantCreateContent: React.FC< @@ -43,7 +44,8 @@ const ProductVariantCreateContent: React.FC< data, dispatchFormDataAction, errors, - step + step, + onStepClick } = props; const classes = useStyles(props); @@ -57,7 +59,7 @@ const ProductVariantCreateContent: React.FC< return (
- +
{step === "values" && ( ({ overflowX: "visible", overflowY: "hidden", width: 800 + }, + spacer: { + flex: 1 } })); @@ -146,19 +149,24 @@ const ProductVariantCreateDialog: React.FC< data={data} dispatchFormDataAction={dispatchFormDataAction} step={step} + onStepClick={step => setStep(step)} /> +
{step !== "values" && ( )} {step !== "summary" ? ( diff --git a/src/products/components/ProductVariantCreateDialog/ProductVariantCreateTabs.tsx b/src/products/components/ProductVariantCreateDialog/ProductVariantCreateTabs.tsx index 5dca6bf57..3d4667f23 100644 --- a/src/products/components/ProductVariantCreateDialog/ProductVariantCreateTabs.tsx +++ b/src/products/components/ProductVariantCreateDialog/ProductVariantCreateTabs.tsx @@ -51,13 +51,15 @@ const useStyles = makeStyles( }, tab: { flex: 1, - paddingBottom: theme.spacing.unit + paddingBottom: theme.spacing.unit, + userSelect: "none" }, tabActive: { fontWeight: 600 }, - tabUnderline: { - borderBottom: `3px solid ${theme.palette.primary.main}` + tabVisited: { + borderBottom: `3px solid ${theme.palette.primary.main}`, + cursor: "pointer" } }), { @@ -67,32 +69,38 @@ const useStyles = makeStyles( export interface ProductVariantCreateTabsProps { step: ProductVariantCreateStep; + onStepClick: (step: ProductVariantCreateStep) => void; } const ProductVariantCreateTabs: React.FC< ProductVariantCreateTabsProps > = props => { - const { step: currentStep } = props; + const { step: currentStep, onStepClick } = props; const classes = useStyles(props); const intl = useIntl(); const steps = getSteps(intl); return (
- {steps.map((step, stepIndex) => ( -
step.value === currentStep) >= stepIndex - })} - key={step.value} - > - - {step.label} - -
- ))} + {steps.map((step, stepIndex) => { + const visitedStep = + steps.findIndex(step => step.value === currentStep) >= stepIndex; + + return ( +
onStepClick(step.value) : undefined} + key={step.value} + > + + {step.label} + +
+ ); + })}
); }; diff --git a/src/products/components/ProductVariantCreateDialog/ProductVariantCreateValues.tsx b/src/products/components/ProductVariantCreateDialog/ProductVariantCreateValues.tsx index 3744bf90a..dd6fe6dc3 100644 --- a/src/products/components/ProductVariantCreateDialog/ProductVariantCreateValues.tsx +++ b/src/products/components/ProductVariantCreateDialog/ProductVariantCreateValues.tsx @@ -50,6 +50,7 @@ const ProductVariantCreateValues: React.FC< onValueClick(attribute.id, value.slug)} time={100} + key={value.slug} > {change => ( )} diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index 5cae43c9c..c97b20359 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -82067,7 +82067,7 @@ exports[`Storyshots Views / Products / Create multiple variants / summary defaul class="ProductVariantCreateTabs-root-id" >
}, flat: { "& span": { - color: colors.primary + color: colors.font.gray } }, flatPrimary: {