mirror of
https://github.com/zhigang1992/react.git
synced 2026-06-12 08:58:55 +08:00
* docs: add link to GH discussions * chore: upgrade deps * chore: update code style for prettier * chore: release v2.1.0-canary.3 * chore(deps): upgrade babel * chore: replace enzyme adapter with community repo to fit react.17 * test: updatee snapshots for auto typesetting * test(config): ignore unexported parts of the tools
26 lines
606 B
TypeScript
26 lines
606 B
TypeScript
import React from 'react'
|
|
import { NormalSizes, NormalTypes } from '../utils/prop-types'
|
|
|
|
export interface ButtonDropdownConfig {
|
|
size?: NormalSizes
|
|
type?: NormalTypes
|
|
auto?: boolean
|
|
disabled?: boolean
|
|
loading?: boolean
|
|
}
|
|
|
|
const defaultContext = {
|
|
size: 'medium' as NormalSizes,
|
|
type: 'default' as NormalTypes,
|
|
auto: false,
|
|
disabled: false,
|
|
loading: false,
|
|
}
|
|
|
|
export const ButtonDropdownContext = React.createContext<ButtonDropdownConfig>(
|
|
defaultContext,
|
|
)
|
|
|
|
export const useButtonDropdown = (): ButtonDropdownConfig =>
|
|
React.useContext<ButtonDropdownConfig>(ButtonDropdownContext)
|