Skip to content

Commit 87a08eb

Browse files
authored
docs: make playground editor take all available space (#8443)
1 parent 14ea806 commit 87a08eb

File tree

4 files changed

+79
-14
lines changed

4 files changed

+79
-14
lines changed

packages/website/docs/play.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/website/src/components/Editor/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ ${fixAssetPaths(js)}`,
219219
?
220220
<div style={{width: "100%"}}>
221221
<Splitter>
222-
{editor}
223222
{preview}
223+
{editor}
224224
</Splitter>
225225
</div>
226226
:

packages/website/src/components/Editor/index.module.css

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,23 @@
2424

2525
.copy-status {
2626
position: relative;
27-
top: -2rem;
28-
left: -1rem;
27+
top: -0.3rem;
28+
left: -4rem;
2929
font-size: 0.75rem;
3030
font-weight: 700;
3131
font-family: Arial;
3232
color: var(--ifm-color-primary);
33+
z-index: 1;
3334
}
3435

3536
.container-standalone {
3637
display: flex;
3738
flex-direction: row-reverse;
3839
width: 100%;
40+
height: 100vh;
41+
}
42+
43+
.container-standalone playground-file-editor {
3944
height: 100%;
4045
}
4146

packages/website/src/pages/play.tsx

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import Editor from "../components/Editor";
2+
import Layout from '@theme/Layout';
3+
4+
const html = `<!-- playground-fold -->
5+
<!DOCTYPE html>
6+
<head>
7+
</head>
8+
9+
<body style="background-color: var(--sapBackgroundColor)">
10+
<!-- playground-fold-end -->
11+
12+
<my-element>
13+
<h1>UI5 Web Components</h1>
14+
</my-element>
15+
<!-- playground-fold -->
16+
<script type="module" src="main.js"></script>
17+
</body>
18+
19+
<!-- playground-fold-end -->
20+
`
21+
22+
const ts = `
23+
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
24+
import litRender, { html } from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
25+
import Integer from "@ui5/webcomponents-base/dist/types/Integer.js";
26+
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
27+
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
28+
29+
@customElement({
30+
tag: "my-element",
31+
renderer: litRender,
32+
})
33+
export class MyElement extends UI5Element {
34+
@property({ type: Integer, defaultValue: 0})
35+
count!: number;
36+
37+
render() {
38+
return html \`
39+
<slot></slot>
40+
<div class="card">
41+
<button @click=\${this._onClick} part="button">
42+
Count is \${this.count}
43+
</button>
44+
</div>\`
45+
}
46+
47+
_onClick() {
48+
this.count += 2;
49+
}
50+
}
51+
52+
MyElement.define();
53+
`;
54+
export default function () {
55+
return (
56+
<>
57+
<Layout>
58+
59+
<Editor
60+
html={html}
61+
js={ts}
62+
css={''}
63+
mainFile={"main.ts"}
64+
canShare={true}
65+
mainFileSelected={true}
66+
standalone={true}
67+
/>
68+
</Layout>
69+
</>
70+
)
71+
}

0 commit comments

Comments
 (0)