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 context = useButtonGroupContext()
|
||||||
const commonProps = useCommonProps(props)
|
const commonProps = useCommonProps(props)
|
||||||
const contextCommonProps = useCommonProps(context)
|
const contextCommonProps = useCommonProps(context || {})
|
||||||
const commonPropsClassName =
|
const commonPropsClassName =
|
||||||
commonProps.className || contextCommonProps.className
|
commonProps.className || contextCommonProps.className
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,15 @@ import React from 'react'
|
||||||
import { ButtonProps } from '../Button/Button'
|
import { ButtonProps } from '../Button/Button'
|
||||||
import { CommonProps } from '../../utils/useCommonProps'
|
import { CommonProps } from '../../utils/useCommonProps'
|
||||||
|
|
||||||
export type ButtonGroupContextType = CommonProps & {
|
export type ButtonGroupContextType =
|
||||||
size?: ButtonProps['size']
|
| (CommonProps & {
|
||||||
variant?: ButtonProps['variant']
|
size?: ButtonProps['size']
|
||||||
disabled?: boolean
|
variant?: ButtonProps['variant']
|
||||||
}
|
disabled?: boolean
|
||||||
|
})
|
||||||
|
| null
|
||||||
|
|
||||||
export const ButtonGroupContext = React.createContext<ButtonGroupContextType>(
|
export const ButtonGroupContext =
|
||||||
null as any,
|
React.createContext<ButtonGroupContextType>(null)
|
||||||
)
|
|
||||||
|
|
||||||
export const useButtonGroupContext = () => React.useContext(ButtonGroupContext)
|
export const useButtonGroupContext = () => React.useContext(ButtonGroupContext)
|
||||||
|
|
Loading…
Reference in New Issue