Skip to content
This repository was archived by the owner on Nov 21, 2025. It is now read-only.

Commit c5c8a3c

Browse files
Kerumenrakannimer
authored andcommitted
style(docz-components): fix live preview background (#1190)
1 parent 5de6367 commit c5c8a3c

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
11
/** @jsx jsx */
22
import * as React from 'react';
3-
import { jsx, SxProps } from 'theme-ui';
3+
import { jsx, SxStyleProp } from 'theme-ui';
44
import get from 'lodash/get';
5+
56
import { Theme } from '../../types';
67

78
const styles = {
8-
iframe: (showingCode: boolean, height = 'auto') =>
9+
wrapper: (showingCode: boolean, height = 'auto') =>
910
({
1011
height,
1112
display: 'block',
1213
minHeight: '100%',
1314
width: 'calc(100% - 2px)',
15+
bg: 'playground.bg',
1416
border: (t: Theme) =>
1517
`1px solid ${get(t, 'colors.playground.border', 'none')}`,
1618
borderRadius: showingCode ? '4px 4px 0 0' : '4px',
17-
} as SxProps['sx']),
19+
} as SxStyleProp),
1820
};
21+
1922
type Props = { showingCode: boolean };
2023

2124
export const LivePreviewWrapper: React.FC<Props> = ({
2225
children,
2326
showingCode,
2427
}) => {
25-
return <div sx={styles.iframe(showingCode)}>{children}</div>;
28+
return <div sx={styles.wrapper(showingCode)}>{children}</div>;
2629
};

core/docz-components/src/components/Playground/styles.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import get from 'lodash/get';
22

33
import * as mixins from '../../utils/mixins';
4+
import { Theme } from '../../types';
45
import { PrismTheme } from 'prism-react-renderer';
6+
import { SxStyleProp } from 'theme-ui';
57

68
export const editor = (theme: PrismTheme) =>
79
({
810
p: 2,
9-
border: (t: PrismTheme) =>
10-
`1px solid ${get(t, 'colors.border', 'transparent')}`,
11+
border: (t: Theme) => `1px solid ${get(t, 'colors.border', 'transparent')}`,
1112
borderRadius: '0 0 4px 4px',
1213
background: get(theme, 'plain.backgroundColor', 'none'),
1314
borderTop: 0,
@@ -18,7 +19,7 @@ export const editor = (theme: PrismTheme) =>
1819
lineHeight: '1.5em ',
1920
outline: 'none',
2021
},
21-
} as any);
22+
} as SxStyleProp);
2223

2324
export const error = {
2425
m: 0,
@@ -36,7 +37,6 @@ export const previewWrapper = {
3637
export const preview = {
3738
m: 0,
3839
p: '20px',
39-
bg: 'playground.bg',
4040
};
4141

4242
export const buttons = {

0 commit comments

Comments
 (0)