diff --git a/ui/blocks/src/BlockContainer/story/StoryBlockContainer.tsx b/ui/blocks/src/BlockContainer/story/StoryBlockContainer.tsx index 31dbdbacf..6684f24d1 100644 --- a/ui/blocks/src/BlockContainer/story/StoryBlockContainer.tsx +++ b/ui/blocks/src/BlockContainer/story/StoryBlockContainer.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React, { FC, useContext } from 'react'; import { BlockContainer, BlockContainerProps, @@ -10,6 +10,7 @@ import { StoryContextProps, } from '../../context'; import { CURRENT_STORY, getStoryBlockTitle } from '../../utils'; +import { PlaygroundContext } from '../../Playground/PlaygroundContext'; export type StoryBlockContainerProps = StoryInputProps & BlockContainerProps; @@ -37,6 +38,7 @@ export const StoryBlockContainer: FC = ({ id, name, }); + const playground = useContext(PlaygroundContext); const { story } = context; const title = getStoryBlockTitle({ story, @@ -44,7 +46,8 @@ export const StoryBlockContainer: FC = ({ }); const block = children && children(context, rest); const description = - userDescription || (useStoryDescription ? story?.description : undefined); + (playground === undefined && userDescription) || + (useStoryDescription ? story?.description : undefined); return block ? ( = ({ children, ...props }) => { background={background} direction={direction} > - {children} + + + {children} + + )} diff --git a/ui/blocks/src/Playground/PlaygroundContext.tsx b/ui/blocks/src/Playground/PlaygroundContext.tsx new file mode 100644 index 000000000..b76f6e1af --- /dev/null +++ b/ui/blocks/src/Playground/PlaygroundContext.tsx @@ -0,0 +1,8 @@ +import { createContext } from 'react'; + +export interface PlaygroundContextProps { + useDescription: boolean; +} +export const PlaygroundContext = createContext({ + useDescription: false, +}); diff --git a/ui/blocks/src/Playground/index.ts b/ui/blocks/src/Playground/index.ts index 469667aff..4f7169a0f 100644 --- a/ui/blocks/src/Playground/index.ts +++ b/ui/blocks/src/Playground/index.ts @@ -1 +1,2 @@ export * from './Playground'; +export * from './PlaygroundContext';