Skip to content

Commit dcc549a

Browse files
committed
added options for data-props to accordion, collapsible and button group
1 parent 967a88e commit dcc549a

File tree

9 files changed

+188
-244
lines changed

9 files changed

+188
-244
lines changed

library/src/components/Accordion.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,13 @@ type AccordionMultipleProps = Pick<
3434
type AccordionContainerProps = (
3535
| AccordionSingleProps
3636
| AccordionMultipleProps
37-
) & { testId?: string }
37+
) & {
38+
"data-testid"?: string
39+
"data-id"?: string
40+
}
3841

39-
const Container = ({ testId, ...props }: AccordionContainerProps) => {
40-
return <RAccordion.Root data-testid={testId} {...props} />
42+
const Container = (props: AccordionContainerProps) => {
43+
return <RAccordion.Root {...props} />
4144
}
4245

4346
type AccordionItemProps = Pick<
@@ -51,11 +54,12 @@ const AccordionItem = React.forwardRef(
5154
forwardedRef: Ref<HTMLDivElement>,
5255
) => (
5356
<RAccordion.Item
57+
{...props}
5458
className={twMerge(
5559
"border-border overflow-hidden border-b-2 first:rounded-t last:rounded-b last:border-b-0 focus-within:relative focus-within:z-10",
5660
className,
5761
)}
58-
{...props}
62+
5963
ref={forwardedRef}
6064
>
6165
{children}

library/src/components/Button.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type React from "react"
2-
import { type CSSProperties, forwardRef, useMemo } from "react"
2+
import { type CSSProperties, forwardRef, type HTMLProps, useMemo } from "react"
33
import { twJoin, twMerge } from "tailwind-merge"
44
import { LoadingSpinner } from "./LoadingSpinner"
55

@@ -211,15 +211,14 @@ export const ButtonGroup = ({
211211
children,
212212
className,
213213
style,
214-
}: {
215-
children: React.ReactNode
216-
className?: string
217-
style?: CSSProperties
218-
}) => {
214+
...props
215+
}: HTMLProps<HTMLDivElement>) => {
219216
return (
220217
<div
218+
{...props}
221219
className={twMerge("inline-flex flex-wrap gap-2 p-2", className)} //gap-2 and p-2 are because of the button outlines on focus
222220
style={style}
221+
223222
>
224223
{children}
225224
</div>

library/src/components/Collapsible.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import ChevronDownIcon from "@atlaskit/icon/glyph/chevron-down"
22
import ChevronRightIcon from "@atlaskit/icon/glyph/chevron-right"
33
import ChevronUpIcon from "@atlaskit/icon/glyph/chevron-up"
44
import * as CollapsibleRUI from "@radix-ui/react-collapsible"
5-
import { forwardRef, useCallback, useState } from "react"
5+
import { forwardRef, type HTMLProps, useCallback, useState } from "react"
66
import { twMerge } from "tailwind-merge"
77

88
type CollapsibleProps = {
@@ -22,7 +22,7 @@ type CollapsibleProps = {
2222
openButtonPosition?: "left" | "right" | "hidden"
2323
id?: string
2424
testId?: string
25-
}
25+
} & HTMLProps<HTMLDivElement>
2626

2727
export const Collapsible = forwardRef(
2828
(
@@ -43,6 +43,7 @@ export const Collapsible = forwardRef(
4343
children,
4444
id,
4545
testId,
46+
...props
4647
}: CollapsibleProps,
4748
ref: React.ForwardedRef<HTMLDivElement>,
4849
) => {
@@ -76,6 +77,7 @@ export const Collapsible = forwardRef(
7677

7778
return (
7879
<CollapsibleRUI.Root
80+
{...props}
7981
open={open}
8082
defaultOpen={defaultOpen}
8183
onOpenChange={openCB}
@@ -84,6 +86,7 @@ export const Collapsible = forwardRef(
8486
data-testid={testId}
8587
id={id}
8688
ref={ref}
89+
8790
>
8891
<CollapsibleRUI.Trigger
8992
className={twMerge(

library/src/layouting/AppLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function Container({
5050
return (
5151
<div
5252
className={twMerge(
53-
"relative m-0 box-border grid h-full min-h-dvh w-full",
53+
"relative m-0 box-border grid h-dvh w-full",
5454
className,
5555
)}
5656
data-layout-container="true"

0 commit comments

Comments
 (0)