mirror of
https://github.com/zhigang1992/react.git
synced 2026-02-09 09:03:51 +08:00
33 lines
741 B
TypeScript
33 lines
741 B
TypeScript
import React from 'react'
|
|
import { Sides } from 'lib/components/sidebar/side-item'
|
|
|
|
export interface Configs {
|
|
onChange?: Function
|
|
isChinese?: boolean
|
|
updateChineseState: Function
|
|
sidebarScrollHeight: number
|
|
updateSidebarScrollHeight: Function
|
|
|
|
sides: Sides[]
|
|
updateSides: Function
|
|
|
|
tabbarFixed: boolean
|
|
updateTabbarFixed: Function
|
|
}
|
|
|
|
export const defaultConfigs: Configs = {
|
|
sidebarScrollHeight: 0,
|
|
updateSidebarScrollHeight: () => {},
|
|
updateChineseState: () => {},
|
|
|
|
sides: [],
|
|
updateSides: () => {},
|
|
|
|
tabbarFixed: false,
|
|
updateTabbarFixed: () => {},
|
|
}
|
|
|
|
export const ConfigContext = React.createContext<Configs>(defaultConfigs)
|
|
|
|
export const useConfigs = (): Configs => React.useContext(ConfigContext)
|