Skip to content

Commit

Permalink
Fix showing empty category input
Browse files Browse the repository at this point in the history
  • Loading branch information
poulch committed Jul 31, 2024
1 parent 8746d05 commit da441d9
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ export const ProductOrganization: React.FC<ProductOrganizationProps> = props =>
errors,
);
const [categoryInputActive, setCategoryInputActive] = React.useState(false);

// Input is hide to proper handle showing nested category structure
const hideInput = !categoryInputActive && data.category && !disabled;

const noCategoryError =
formErrors.isPublished?.code === ProductErrorCode.PRODUCT_WITHOUT_CATEGORY
? formErrors.isPublished
Expand Down Expand Up @@ -161,12 +165,11 @@ export const ProductOrganization: React.FC<ProductOrganizationProps> = props =>
id: "ccXLVi",
defaultMessage: "Category",
})}
{...(!categoryInputActive &&
!disabled && {
width: "100%",
__opacity: 0,
position: "absolute",
})}
{...(hideInput && {
width: "100%",
__opacity: 0,
position: "absolute",
})}
onFocus={() => {
setCategoryInputActive(true);
}}
Expand Down

0 comments on commit da441d9

Please sign in to comment.