Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TICDI-103 - always display provisions/variables collapsibles #230

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions frontend/src/app/components/common/Collapsible.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ interface CollapsibleProps {
title: string;
children: React.ReactNode;
isOpen: boolean;
enabled?: boolean;
}

const Collapsible: FC<CollapsibleProps> = ({ title, children, isOpen }) => {
const Collapsible: FC<CollapsibleProps> = ({ title, children, isOpen, enabled = true }) => {
const [isOpenonClick, setIsOpenOnClick] = useState(isOpen);
const icon = isOpenonClick ? faMinus : (faPlus as IconProp);

const contentStyle = {
display: isOpenonClick ? 'block' : 'none',
display: enabled ? (isOpenonClick ? 'block' : 'none') : 'none',
};

const toggleCollapsibleOnClick = () => {
Expand All @@ -31,10 +32,10 @@ const Collapsible: FC<CollapsibleProps> = ({ title, children, isOpen }) => {
<div className="mb-2 d-flex align-items-center">
<FontAwesomeIcon
icon={icon as IconProp}
className="inlineDiv collapsibleTitle"
className={`inlineDiv collapsibleTitle`}
onClick={toggleCollapsibleOnClick}
/>
<div className="ml-2 inlineDiv collapsibleTitle boldText" onClick={toggleCollapsibleOnClick}>
<div className={`ml-2 inlineDiv collapsibleTitle boldText`} onClick={toggleCollapsibleOnClick}>
{title}
</div>
</div>
Expand Down
23 changes: 11 additions & 12 deletions frontend/src/app/content/pages/LandingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -476,19 +476,18 @@ const LandingPage: FC = () => {
{data ? <InterestedParties data={data!} /> : <Skeleton />}
</Collapsible>

{provisionGroups && dtid && documentType ? (
<>
<Collapsible title="Provisions" isOpen={false}>
<Provisions dtid={dtid} documentType={documentType} provisionGroups={provisionGroups} />
</Collapsible>
<Collapsible title="Provisions" isOpen={false} enabled={provisionGroups && dtid && documentType ? true : false}>
{provisionGroups && dtid && documentType ? (
<Provisions dtid={dtid} documentType={documentType} provisionGroups={provisionGroups} />
) : (
<></>
)}
</Collapsible>

<Collapsible title="Variables" isOpen={false} enabled={provisionGroups && dtid && documentType ? true : false}>
{provisionGroups && dtid && documentType ? <VariablesTable onVariableEdit={handleVariableEdit} /> : <></>}
</Collapsible>

<Collapsible title="Variables" isOpen={false}>
<VariablesTable onVariableEdit={handleVariableEdit} />
</Collapsible>
</>
) : (
<></>
)}
<>
{' '}
{showGenerateError && (
Expand Down
Loading