Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
adrians5j committed Feb 6, 2025
1 parent 2203129 commit 2d65e51
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions packages/admin-ui/src/Accordion/Accordion.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from "react";
import React, { useMemo } from "react";
import { cn, makeDecoratable, withStaticProps } from "~/utils";
import { AccordionRoot } from "./components/AccordionRoot";
import { AccordionContext, useAccordion } from "./components/AccordionContext";
Expand All @@ -14,14 +14,25 @@ const AccordionBase = ({
children,
variant,
background = "base",
...rootProps
...baseRootProps
}: AccordionProps) => {
const rootProps = useMemo(() => {
const rootProps = { ...baseRootProps };
if (rootProps.type !== "multiple") {
// For single accordion, make it collapsible by default.
rootProps.collapsible = rootProps.collapsible !== false;
}
return rootProps;
}, [baseRootProps]);

return (
<AccordionRoot
className={cn("w-full", {
"wby-gap-xs wby-flex wby-flex-col": variant === "container"
})}
{...rootProps}
className={cn(
"w-full",
{ "wby-gap-xs wby-flex wby-flex-col": variant === "container" },
rootProps.className
)}
>
<AccordionContext.Provider value={{ variant, background }}>
{children}
Expand Down

0 comments on commit 2d65e51

Please sign in to comment.