Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LivePreview - fix UI #3667

Merged
merged 4 commits into from
Apr 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions docuilib/src/components/UILivePreview.module.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
$preview-width: 350px;
$preview-margin: 60px;
$preview-width: 340px;
$preview-margin: 50px;
$editor-height: 700px;

.container {
display: flex;
background-color: #1D1E21;
border-radius: 8px;
padding: 50px
}

.liveEditor {
height: $editor-height;

span {
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 14px;
font-weight: 600;
line-height: 24px;
letter-spacing: -0.028px;
}
}

.codeContainer {
Expand All @@ -21,6 +32,8 @@ $editor-height: 700px;
pre {
min-height: 100%;
padding: 20px !important;
background-color: #1D1E21 !important;
border-right: 1px solid #D2D6D8;
}
}

Expand All @@ -29,14 +42,19 @@ $editor-height: 700px;
bottom: 0;
left: 0;
right: 0;

pre {
background-color: rgba(255, 255, 255, 0.80) !important;
margin: 10px;
}
}

.preview {
position: relative;
width: $preview-width;
margin-left: $preview-margin;
border-radius: 36px;
border: 1px solid #ddd;
border: 10px solid rgba(255, 255, 255, 0.20);
box-shadow: 0 0 15px rgba(110, 120, 129, 0.05);
overflow: hidden;
}
Expand All @@ -49,4 +67,5 @@ $editor-height: 700px;
left: 0;
border: 0;
padding: 10;
background-color: #fff;
}
5 changes: 4 additions & 1 deletion docuilib/src/components/pageComponents/SectionHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React, {useMemo} from 'react';
import '../ComponentPage.module.scss';
import showdownMarkdown from 'showdown';
import ReactHtmlParser from 'react-html-parser';
import {isComponentSupported} from '../../utils/componentUtils';
import '../ComponentPage.module.scss';


export const SectionHeader = ({section, component}) => {
const {title, description, type} = section;
Expand All @@ -26,6 +28,7 @@ export const SectionHeader = ({section, component}) => {
};

const getUsageTitle = () => {
const title = isComponentSupported(component.name) ? 'Playground' : 'Usage';
if (component.snippet) {
return (
<div
Expand Down
2 changes: 1 addition & 1 deletion docuilib/src/pages/livePreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {IFRAME_MESSAGE_TYPE} from '@site/src/components/UILivePreview';
import ReactLiveScope from '../theme/ReactLiveScope';
import styles from './livePreview.module.css';

export default function UILivePreview() {
export default function LivePreviewWrapper() {
const [code, setCode] = useState(``);

useEffect(() => {
Expand Down