kiner-tang(文辉)
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
14 additions and
8 deletions
-
components/space/Item.tsx
-
components/space/context.ts
-
components/space/index.tsx
|
|
@ -1,5 +1,5 @@ |
|
|
|
import * as React from 'react'; |
|
|
|
import { SpaceContext } from '.'; |
|
|
|
import { SpaceContext } from './context'; |
|
|
|
|
|
|
|
export interface ItemProps { |
|
|
|
className: string; |
|
|
|
|
|
@ -0,0 +1,10 @@ |
|
|
|
import React from 'react'; |
|
|
|
|
|
|
|
export const SpaceContext = React.createContext({ |
|
|
|
latestIndex: 0, |
|
|
|
horizontalSize: 0, |
|
|
|
verticalSize: 0, |
|
|
|
supportFlexGap: false, |
|
|
|
}); |
|
|
|
|
|
|
|
export const SpaceContextProvider = SpaceContext.Provider; |
|
|
@ -7,14 +7,10 @@ import type { SizeType } from '../config-provider/SizeContext'; |
|
|
|
import Compact from './Compact'; |
|
|
|
import Item from './Item'; |
|
|
|
|
|
|
|
import { SpaceContextProvider } from './context'; |
|
|
|
import useStyle from './style'; |
|
|
|
|
|
|
|
export const SpaceContext = React.createContext({ |
|
|
|
latestIndex: 0, |
|
|
|
horizontalSize: 0, |
|
|
|
verticalSize: 0, |
|
|
|
supportFlexGap: false, |
|
|
|
}); |
|
|
|
export type { SpaceContext } from './context'; |
|
|
|
|
|
|
|
export type SpaceSize = SizeType | number; |
|
|
|
|
|
|
@ -159,7 +155,7 @@ const Space = React.forwardRef<HTMLDivElement, SpaceProps>((props, ref) => { |
|
|
|
}} |
|
|
|
{...otherProps} |
|
|
|
> |
|
|
|
<SpaceContext.Provider value={spaceContext}>{nodes}</SpaceContext.Provider> |
|
|
|
<SpaceContextProvider value={spaceContext}>{nodes}</SpaceContextProvider> |
|
|
|
</div>, |
|
|
|
); |
|
|
|
}); |
|
|
|