Skip to content

Commit

Permalink
Forward props to CouponAccordion
Browse files Browse the repository at this point in the history
  • Loading branch information
paales committed Jan 20, 2025
1 parent 2bdeddf commit 3b45e14
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/lemon-sloths-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphcommerce/magento-cart-coupon': patch
---

Forward props to CouponAccordion
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ 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<Theme> }
export type CouponAccordionProps = Omit<AccordionProps, 'expanded' | 'onChange' | 'children'>

type OwnerState = { open: boolean; disabled: boolean }
const name = 'CouponAccordion'
const parts = ['accordion', 'button', 'couponFormWrap'] as const
const { withState } = extendableComponent<OwnerState, typeof name, typeof parts>(name, parts)

export function CouponAccordion(props: CouponAccordionProps) {
const { sx = [] } = props
const { sx = [], ...rest } = props
const { data } = useCartQuery(GetCouponDocument)
const [open, setOpen] = useState<boolean>(false)

Expand Down Expand Up @@ -53,6 +53,7 @@ export function CouponAccordion(props: CouponAccordionProps) {
}),
...(Array.isArray(sx) ? sx : [sx]),
]}
{...rest}
>
<AccordionSummary
onClick={(e) => e.preventDefault()}
Expand Down

0 comments on commit 3b45e14

Please sign in to comment.