mirror of https://github.com/acid-info/lsd.git
fix: remove null as any context initialization
This commit is contained in:
parent
c49364fa71
commit
eb5dddb5ae
|
@ -27,7 +27,7 @@ export const Button: React.FC<ButtonProps> & {
|
|||
}) => {
|
||||
const context = useButtonGroupContext()
|
||||
const commonProps = useCommonProps(props)
|
||||
const contextCommonProps = useCommonProps(context)
|
||||
const contextCommonProps = useCommonProps(context || {})
|
||||
const commonPropsClassName =
|
||||
commonProps.className || contextCommonProps.className
|
||||
|
||||
|
|
|
@ -2,14 +2,15 @@ import React from 'react'
|
|||
import { ButtonProps } from '../Button/Button'
|
||||
import { CommonProps } from '../../utils/useCommonProps'
|
||||
|
||||
export type ButtonGroupContextType = CommonProps & {
|
||||
size?: ButtonProps['size']
|
||||
variant?: ButtonProps['variant']
|
||||
disabled?: boolean
|
||||
}
|
||||
export type ButtonGroupContextType =
|
||||
| (CommonProps & {
|
||||
size?: ButtonProps['size']
|
||||
variant?: ButtonProps['variant']
|
||||
disabled?: boolean
|
||||
})
|
||||
| null
|
||||
|
||||
export const ButtonGroupContext = React.createContext<ButtonGroupContextType>(
|
||||
null as any,
|
||||
)
|
||||
export const ButtonGroupContext =
|
||||
React.createContext<ButtonGroupContextType>(null)
|
||||
|
||||
export const useButtonGroupContext = () => React.useContext(ButtonGroupContext)
|
||||
|
|
Loading…
Reference in New Issue