Skip to content

Commit

Permalink
fix: story description visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Oct 13, 2020
1 parent 270e7b4 commit 215698f
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 5 deletions.
1 change: 1 addition & 0 deletions ui/blocks/src/Playground/StoryPlayground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const StoryPlayground: FC<StoryPlaygroundProps> = ({
return (
<BasePlayground
wrapper={false}
story={story}
actions={[...actions, ...storyActions]}
{...props}
/>
Expand Down
2 changes: 1 addition & 1 deletion ui/blocks/src/Stories/Stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const Stories: FC<StoriesProps> = ({ id, name, title, ...rest }) => {
return null;
}
return (
<StoryBlockContainer title={title} {...rest}>
<StoryBlockContainer story={story} title={title} {...rest}>
{stories.map((id: string) => {
const story = store.stories[id];
return (
Expand Down
2 changes: 1 addition & 1 deletion ui/blocks/src/Story/Story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const Story: FC<StoryProps> = forwardRef(

if (story && story.id && story.renderFn) {
return (
<StoryBlockContainer {...rest}>
<StoryBlockContainer {...rest} story={story}>
<StoryRender
ref={ref}
story={story}
Expand Down
2 changes: 1 addition & 1 deletion ui/blocks/src/StoryConfig/StoryConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const StoryConfig: FC<StoryConfigProps> = ({
const doc = useCurrentDocument();
const docPackage = usePackage(doc?.package);
return (
<StoryBlockContainer {...rest}>
<StoryBlockContainer story={story} {...rest}>
<BaseStoryConfig
story={story}
doc={doc}
Expand Down
2 changes: 1 addition & 1 deletion ui/blocks/src/StorySource/StorySource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const StorySource: FC<StorySourceProps> = ({
const docPackage = usePackage(doc?.package);

return (
<StoryBlockContainer {...rest}>
<StoryBlockContainer story={story} {...rest}>
<BaseStorySource
story={story}
doc={doc}
Expand Down
13 changes: 12 additions & 1 deletion ui/components/src/BlockContainer/BlockContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable react/display-name */
/** @jsx jsx */
import React, { FC } from 'react';
import { jsx, Flex, Link, Divider, Box, SxStyleProp, Text } from 'theme-ui';
Expand Down Expand Up @@ -92,7 +93,17 @@ export const BlockContainer: FC<BlockContainerProps> = ({
))}
</LinkHeading>
)}
{description && <Markdown>{description}</Markdown>}
{description && (
<Markdown
components={{
p: props => (
<Box as="p" variant="blockcontainer.description.p" {...props} />
),
}}
>
{description}
</Markdown>
)}
{collapsible && children ? (
<Collapsible isOpen={isOpen}>{children}</Collapsible>
) : (
Expand Down
6 changes: 6 additions & 0 deletions ui/components/src/ThemeContext/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,12 @@ export const theme: ControlsTheme = {
},
},
},
description: {
p: {
my: 1,
},
},

link: {
position: 'absolute',
left: -4,
Expand Down

0 comments on commit 215698f

Please sign in to comment.