Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
carolineBda committed Jan 9, 2025
1 parent 4e2a2a1 commit ebee652
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { fr } from "@codegouvfr/react-dsfr";

export type Props = {
titleAs?: `h${2 | 3 | 4 | 5 | 6}`;
className?: string;
items: {
id?: string;
title: string;
Expand All @@ -19,7 +18,6 @@ export type Props = {
export const AccordionWithAnchor = ({
items,
titleAs = "h2",
className,
}: Props): React.ReactElement => {
const path = useRouter();
const [anchor, setAnchor] = useState<string | null>();
Expand Down Expand Up @@ -67,10 +65,7 @@ export const AccordionWithAnchor = ({
}

return (
<div
className={`${fr.cx("fr-accordions-group")} ${className}`}
data-fr-group="false"
>
<div className={fr.cx("fr-accordions-group")} data-fr-group="false">
{itemsWithId.map((item) => (
<Accordion
titleAs={titleAs}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import parse, {
Text,
DOMNode,
domToReact,
Element,
HTMLReactParserOptions,
Text,
} from "html-react-parser";
import { xssWrapper } from "../../lib";
import Alert from "@codegouvfr/react-dsfr/Alert";
Expand Down Expand Up @@ -56,13 +56,14 @@ const mapToAccordion = (titleLevel: numberLevel, items) => {
const props = titleLevel <= 6 ? { titleLevel } : {};

return (
<AccordionWithAnchor
{...props}
data-testid="contrib-accordion"
items={items.map((item) => ({ ...item, id: generateUUID() }))}
titleAs={`h${titleLevel}`}
className={fr.cx("fr-my-3w")}
/>
<div className={fr.cx("fr-my-3w")}>
<AccordionWithAnchor
{...props}
data-testid="contrib-accordion"
items={items.map((item) => ({ ...item, id: generateUUID() }))}
titleAs={`h${titleLevel}`}
/>
</div>
);
};

Expand Down

0 comments on commit ebee652

Please sign in to comment.