From 3b45e1426da4dd4caf1cc76f0707af07474ffd2e Mon Sep 17 00:00:00 2001 From: Paul Hachmang Date: Mon, 20 Jan 2025 11:41:14 +0100 Subject: [PATCH] Forward props to CouponAccordion --- .changeset/lemon-sloths-approve.md | 5 +++++ .../CouponAccordion/CouponAccordion.tsx | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 .changeset/lemon-sloths-approve.md diff --git a/.changeset/lemon-sloths-approve.md b/.changeset/lemon-sloths-approve.md new file mode 100644 index 0000000000..44e7dddb89 --- /dev/null +++ b/.changeset/lemon-sloths-approve.md @@ -0,0 +1,5 @@ +--- +'@graphcommerce/magento-cart-coupon': patch +--- + +Forward props to CouponAccordion diff --git a/packages/magento-cart-coupon/CouponAccordion/CouponAccordion.tsx b/packages/magento-cart-coupon/CouponAccordion/CouponAccordion.tsx index 89137c85f1..cfa72e0e98 100644 --- a/packages/magento-cart-coupon/CouponAccordion/CouponAccordion.tsx +++ b/packages/magento-cart-coupon/CouponAccordion/CouponAccordion.tsx @@ -6,14 +6,14 @@ import { IconSvg, } from '@graphcommerce/next-ui' import { Trans } from '@lingui/react' -import type { SxProps, Theme } from '@mui/material' +import type { AccordionProps, SxProps, Theme } from '@mui/material' import { Accordion, AccordionDetails, AccordionSummary } from '@mui/material' import { useState } from 'react' import { ApplyCouponForm } from '../ApplyCouponForm/ApplyCouponForm' import { RemoveCouponForm } from '../RemoveCouponForm/RemoveCouponForm' import { GetCouponDocument } from './GetCoupon.gql' -export type CouponAccordionProps = { sx?: SxProps } +export type CouponAccordionProps = Omit type OwnerState = { open: boolean; disabled: boolean } const name = 'CouponAccordion' @@ -21,7 +21,7 @@ const parts = ['accordion', 'button', 'couponFormWrap'] as const const { withState } = extendableComponent(name, parts) export function CouponAccordion(props: CouponAccordionProps) { - const { sx = [] } = props + const { sx = [], ...rest } = props const { data } = useCartQuery(GetCouponDocument) const [open, setOpen] = useState(false) @@ -53,6 +53,7 @@ export function CouponAccordion(props: CouponAccordionProps) { }), ...(Array.isArray(sx) ? sx : [sx]), ]} + {...rest} > e.preventDefault()}