fix(ui/form): expandable form section [EE-4799] (#8866)

pull/5116/merge
Chaim Lev-Ari 2023-05-16 10:39:52 +07:00 committed by GitHub
parent 23e3cdb193
commit 5f3c0ff835
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -1,5 +1,5 @@
import { PropsWithChildren, ReactNode, useState } from 'react'; import { PropsWithChildren, ReactNode, useState } from 'react';
import { ChevronDown, ChevronRight } from 'lucide-react'; import { ChevronUp, ChevronRight } from 'lucide-react';
import { Icon } from '@@/Icon'; import { Icon } from '@@/Icon';
@ -24,11 +24,15 @@ export function FormSection({
<button <button
id={`foldingButton${title}`} id={`foldingButton${title}`}
type="button" type="button"
onClick={() => setIsExpanded(!isExpanded)} onClick={(e) => {
setIsExpanded(!isExpanded);
e.stopPropagation();
e.preventDefault();
}}
className="mx-2 !ml-0 inline-flex w-2 items-center justify-center border-0 bg-transparent" className="mx-2 !ml-0 inline-flex w-2 items-center justify-center border-0 bg-transparent"
> >
<Icon <Icon
icon={isExpanded ? ChevronDown : ChevronRight} icon={isExpanded ? ChevronUp : ChevronRight}
className="shrink-0" className="shrink-0"
/> />
</button> </button>