File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 11import React , { forwardRef } from 'react'
2- import { ForwardRefComponent as PolymorphicForwardRefComponent } from '@radix-ui/react-polymorphic'
32import { ButtonProps } from './types'
43import { ButtonBase } from './ButtonBase'
54
6- const ButtonComponent = forwardRef (
7- ( { children, as : As = 'button' , ...props } , forwardedRef ) : JSX . Element => {
5+ const ButtonComponent = forwardRef < HTMLButtonElement , ButtonProps > (
6+ ( { children, ...props } , forwardedRef ) : JSX . Element => {
87 return (
9- < ButtonBase ref = { forwardedRef } as = { As } { ...props } >
8+ < ButtonBase ref = { forwardedRef } as = "button" { ...props } >
109 { children }
1110 </ ButtonBase >
1211 )
1312 }
14- ) as PolymorphicForwardRefComponent < 'button' | 'a' , ButtonProps >
13+ )
1514
1615ButtonComponent . displayName = 'Button'
1716
Original file line number Diff line number Diff line change @@ -13,7 +13,10 @@ export type VariantType = 'default' | 'primary' | 'invisible' | 'danger' | 'outl
1313
1414export type Size = 'small' | 'medium' | 'large'
1515
16- type StyledButtonProps = ComponentPropsWithRef < typeof StyledButton >
16+ /**
17+ * Remove styled-components polymorphic as prop, which conflicts with radix's
18+ */
19+ type StyledButtonProps = Omit < ComponentPropsWithRef < typeof StyledButton > , 'as' >
1720
1821type ButtonA11yProps = { 'aria-label' : string ; 'aria-labelby' ?: never } | { 'aria-label' ?: never ; 'aria-labelby' : string }
1922
You can’t perform that action at this time.
0 commit comments