Skip to content

Commit

Permalink
DetailsSummary replace open
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsSammyM committed Dec 1, 2024
1 parent d1276e8 commit b5f29ec
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions client/src/components/DetailsSummary.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReactElement, ReactNode } from "react";
import { ReactElement, ReactNode, useMemo } from "react";
import React from "react";
import "./detailsSummary.css";
import Icon from "./Icon";
Expand All @@ -8,10 +8,16 @@ export default function DetailsSummary(props: Readonly<{
dropdownArrow?: boolean,
children?: ReactNode,
defaultOpen?: boolean,
open?: boolean,
onClick?: () => void
}>): ReactElement {

const [open, setOpen] = React.useState(props.defaultOpen??false);
const [openState, setOpen] = React.useState(props.defaultOpen??false);

const open = useMemo(() => {
if(props.open !== undefined) return props.open;
return openState;
}, [props.open, openState]);

return <div className="details-summary-container">
<div className="details-summary-summary-container"
Expand Down

0 comments on commit b5f29ec

Please sign in to comment.