From cf82f64c14a7922ce42ce3efbb7fe184cc115949 Mon Sep 17 00:00:00 2001 From: Steve Garon Date: Tue, 3 Aug 2021 14:16:16 +0000 Subject: [PATCH] Have section collapsed by default when auto-collapsed is true --- src/components/visual/ResultCard/result_section.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/visual/ResultCard/result_section.tsx b/src/components/visual/ResultCard/result_section.tsx index 0c23c8d30..1ce6b40a7 100644 --- a/src/components/visual/ResultCard/result_section.tsx +++ b/src/components/visual/ResultCard/result_section.tsx @@ -427,6 +427,7 @@ export type SectionItem = { }; export type Section = { + auto_collapse: boolean; body: any; body_format: string; classification: string; @@ -474,7 +475,7 @@ const ResultSection: React.FC = ({ const classes = useStyles(); const theme = useTheme(); const section = section_list[id]; - const [open, setOpen] = React.useState(true); + const [open, setOpen] = React.useState(!section.auto_collapse); const { getKey, hasHighlightedKeys } = useHighlighter(); const { c12nDef } = useALContext();