Skip to content

Commit

Permalink
fix: restore story block style
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Dec 28, 2020
1 parent 507d506 commit b5ee186
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 16 deletions.
4 changes: 1 addition & 3 deletions ui/blocks/src/Story/Story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import {
StoryBlockContainerProps,
} from '../BlockContainer/story';
import { useCustomProps } from '../context';
import { StoryRender, StoryWrapperType } from './StoryRender';

const NAME = 'story';
import { StoryRender, StoryWrapperType, NAME } from './StoryRender';

export interface StoryOwnProps {
/**
Expand Down
6 changes: 3 additions & 3 deletions ui/blocks/src/Story/StoryRender.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @jsx jsx */
import { FC, forwardRef, Ref, useState, Fragment } from 'react';
import { jsx, CSSProperties, Box } from 'theme-ui';
import { jsx, CSSProperties, Box, BoxProps } from 'theme-ui';

import Iframe from 'react-frame-component';
import ReactResizeDetector from 'react-resize-detector';
Expand Down Expand Up @@ -73,10 +73,10 @@ const StoryWrapper: FC<StoryWrapperProps> = ({
};
export const NAME = 'story';

export interface StoryRenderProps {
export type StoryRenderProps = {
story: Story;
ref?: Ref<HTMLDivElement>;
}
} & BoxProps;
export const StoryRender: FC<StoryRenderProps & StoryWrapperProps> = forwardRef(
function StoryRender(
{ story, wrapper, iframeStyle, ...rest },
Expand Down
1 change: 1 addition & 0 deletions ui/blocks/src/Story/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './Story';
export { StoryRender } from './StoryRender';
4 changes: 2 additions & 2 deletions ui/components/src/BlockContainer/BlockContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ export const BlockContainer: FC<BlockContainerProps> = ({
children
);
return (
<Box variant={`blockcontainer.${plain ? 'plain' : 'container'}`} {...rest}>
{(blockId || title || collapsible) && !plain && (
<Box variant="blockcontainer.container" {...rest}>
{(blockId || title || collapsible) && (
<LinkHeading
as={collapsible ? 'h3' : 'h4'}
id={blockId}
Expand Down
5 changes: 0 additions & 5 deletions ui/components/src/ThemeContext/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,11 +428,6 @@ export const theme: ControlsTheme = {
width: '100%',
scrollMarginTop: '5rem',
},
plain: {
position: 'relative',
width: '100%',
scrollMarginTop: '5rem',
},
inner: {
boxShadow: (t: Theme): string => `0px 1px 3px 0px ${t.colors?.shadow}`,
border: (t: Theme): string => ` 1px solid ${t.colors?.shadow}`,
Expand Down
9 changes: 6 additions & 3 deletions ui/pages/src/pages/CanvasPage.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import React, { FC } from 'react';
import { TabConfiguration } from '@component-controls/core';
import { Story } from '@component-controls/blocks';

const CanvasPage: FC = () => <Story id="." plain />;
import { useCurrentStory } from '@component-controls/store';
import { StoryRender } from '@component-controls/blocks';

const CanvasPage: FC = () => {
const story = useCurrentStory();
return story ? <StoryRender story={story} /> : null;
};
export default {
title: 'Canvas',
component: CanvasPage,
Expand Down

0 comments on commit b5ee186

Please sign in to comment.