Skip to content

Commit

Permalink
Resolve capital project detail panel hiding
Browse files Browse the repository at this point in the history
Refactor capital project detail panel to use updated panel component properly

closes #84
  • Loading branch information
TangoYankee committed Aug 22, 2024
1 parent e9d789b commit e5a36da
Showing 1 changed file with 12 additions and 35 deletions.
47 changes: 12 additions & 35 deletions app/routes/capital-projects.$managingCode.$capitalProjectId.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ import {
findCapitalCommitmentsByManagingCodeCapitalProjectId,
findCapitalCommitmentTypes,
} from "../gen";
import { Flex } from "@nycplanning/streetscape";
import { useState } from "react";
import { MobilePanelResizeBar } from "~/components/MobilePanelResizeBar";
import { CapitalProjectPanel } from "~/components/CapitalProjectPanel";

export async function loader({ params }: LoaderFunctionArgs) {
Expand Down Expand Up @@ -68,39 +65,19 @@ export default function CapitalProject() {
agencies,
capitalCommitmentTypes,
} = useLoaderData<typeof loader>();
const [commitmentsAreVisible, setCommitmentsAreVisible] = useState(false);

const toggleCommitmentsAreVisible = () =>
setCommitmentsAreVisible((commitmentsAreVisible) => !commitmentsAreVisible);

return (
<Flex
borderTopRadius={"base"}
borderBottomRadius={{ base: "0", lg: "base" }}
background={"white"}
direction={"column"}
width={{ base: "full", lg: "21.25rem" }}
maxW={{ lg: "unset" }}
boxShadow={"0px 8px 4px 0px rgba(0, 0, 0, 0.08)"}
position={{ base: "fixed", lg: "static" }}
>
<MobilePanelResizeBar
isExpanded={commitmentsAreVisible}
isExpandedToggle={toggleCommitmentsAreVisible}
marginTop={"0.75rem"}
/>
<CapitalProjectPanel
capitalProject={capitalProject}
capitalCommitments={capitalCommitments}
capitalCommitmentTypes={capitalCommitmentTypes}
agencies={agencies}
onNavigationClick={() => {
navigate({
pathname: "/",
search: `?${searchParams.toString()}`,
});
}}
/>
</Flex>
<CapitalProjectPanel
capitalProject={capitalProject}
capitalCommitments={capitalCommitments}
capitalCommitmentTypes={capitalCommitmentTypes}
agencies={agencies}
onNavigationClick={() => {
navigate({
pathname: "/",
search: `?${searchParams.toString()}`,
});
}}
/>
);
}

0 comments on commit e5a36da

Please sign in to comment.