|
1 | 1 | // eslint-disable-next-line import/no-internal-modules
|
2 | 2 |
|
3 |
| -import { Accordion, AccordionHeader, AccordionItem, AccordionPanel, makeStyles, Subtitle1, tokens } from "@fluentui/react-components"; |
4 |
| -import { useMemo, useState, type ComponentType } from "react"; |
| 3 | +import type { ComponentType } from "react"; |
| 4 | + |
| 5 | +import { makeStyles } from "@fluentui/react-components"; |
| 6 | +import { useMemo, useState } from "react"; |
| 7 | + |
| 8 | +import { Accordion, AccordionSection } from "shared-ui-components/fluent/primitives/accordion"; |
5 | 9 |
|
6 | 10 | export type AccordionSection = Readonly<{
|
7 | 11 | /**
|
@@ -58,16 +62,6 @@ const useStyles = makeStyles({
|
58 | 62 | display: "flex",
|
59 | 63 | flexDirection: "column",
|
60 | 64 | },
|
61 |
| - placeholderDiv: { |
62 |
| - padding: `${tokens.spacingVerticalM} ${tokens.spacingHorizontalM}`, |
63 |
| - }, |
64 |
| - accordion: { |
65 |
| - overflowY: "auto", |
66 |
| - paddingBottom: tokens.spacingVerticalM, |
67 |
| - display: "flex", |
68 |
| - flexDirection: "column", |
69 |
| - rowGap: tokens.spacingVerticalM, |
70 |
| - }, |
71 | 65 | panelDiv: {
|
72 | 66 | display: "flex",
|
73 | 67 | flexDirection: "column",
|
@@ -122,27 +116,14 @@ export function AccordionPane<ContextT = unknown>(props: {
|
122 | 116 | return (
|
123 | 117 | <div className={classes.rootDiv}>
|
124 | 118 | {visibleSections.length > 0 && (
|
125 |
| - <Accordion |
126 |
| - key={version} |
127 |
| - className={classes.accordion} |
128 |
| - collapsible |
129 |
| - multiple |
130 |
| - defaultOpenItems={visibleSections.filter((section) => !section.collapseByDefault).map((section) => section.identity.description)} |
131 |
| - > |
| 119 | + <Accordion key={version}> |
132 | 120 | {visibleSections.map((section) => {
|
133 | 121 | return (
|
134 |
| - <AccordionItem key={section.identity.description} value={section.identity.description}> |
135 |
| - <AccordionHeader expandIconPosition="end"> |
136 |
| - <Subtitle1>{section.identity.description}</Subtitle1> |
137 |
| - </AccordionHeader> |
138 |
| - <AccordionPanel> |
139 |
| - <div className={classes.panelDiv}> |
140 |
| - {section.components.map((component) => { |
141 |
| - return <component.component key={component.key} context={context} />; |
142 |
| - })} |
143 |
| - </div> |
144 |
| - </AccordionPanel> |
145 |
| - </AccordionItem> |
| 122 | + <AccordionSection key={section.identity.description} title={section.identity.description!}> |
| 123 | + {section.components.map((component) => { |
| 124 | + return <component.component key={component.key} context={context} />; |
| 125 | + })} |
| 126 | + </AccordionSection> |
146 | 127 | );
|
147 | 128 | })}
|
148 | 129 | </Accordion>
|
|
0 commit comments