Skip to content

Commit df82f81

Browse files
committed
fix: update the demo
1 parent fa14408 commit df82f81

File tree

1 file changed

+90
-18
lines changed

1 file changed

+90
-18
lines changed

demo/App.vue

Lines changed: 90 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
11
<template>
2-
<main style="text-align:center;">
3-
<h1>Vue Live renders vue code directly in the browser</h1>
4-
<a href="https://github.com/vue-styleguidist/vue-live/tree/master/demo"
5-
>Check out the source for this demo</a
6-
>
7-
<h2>With imported components and the code-editor lineNumers</h2>
8-
<VueLive
9-
:editorProps="{ lineNumbers: true }"
10-
:code="codeTemplate"
11-
:layout="CustomLayout"
12-
:components="registeredComponents"
13-
/>
2+
<main style="text-align: center;">
3+
<h1>Vue Live renders vue code in the browser</h1>
4+
<p class="description">
5+
<em>vue-live</em> is a VueJs component. It renders the code passed in prop
6+
using the VueJs compiler - yes exactly like the vuejs compiler. But wait!
7+
it has a <b>super-power</b>! It keeps the rendered code reactive in the
8+
browser.
9+
</p>
10+
<p class="description">
11+
If you edit the code in the editor on the left, the preview on the right
12+
will update automatically.
13+
</p>
14+
15+
<div class="livebox">
16+
<div class="hint">You can edit this <span>-></span></div>
17+
<VueLive
18+
:editorProps="{ lineNumbers: true }"
19+
:code="codeTemplate"
20+
:layout="CustomLayout"
21+
:components="registeredComponents"
22+
/>
23+
</div>
24+
25+
<p>Here are a few examples of use</p>
26+
1427
<h2>Display Single File Components</h2>
1528
<VueLive :code="codeSfc" :layout="CustomLayout" />
1629
<h2>Pure JavaScript code</h2>
@@ -31,7 +44,7 @@
3144
:delay="2000"
3245
/>
3346
<h2>Default Layout</h2>
34-
<div style="width:950px; max-width:95vw; margin:20px auto;">
47+
<div style="width: 950px; max-width: 95vw; margin: 20px auto;">
3548
<VueLive :code="`<input type='button' value='I am Groot' />`" />
3649
</div>
3750
<h2>Custom Layout</h2>
@@ -59,12 +72,20 @@
5972
<div class="preview-separate">
6073
<VueLivePreview :code="separateCode" />
6174
</div>
75+
<hr style="width: 950px;" />
76+
<p>Edit the code here</p>
6277
<VueLiveEditor :code="separateCode" @change="updateCode" />
78+
<div class="button-bar"><button>Save</button></div>
6379
</div>
80+
81+
<github-corners
82+
url="https://github.com/vue-styleguidist/vue-live"
83+
gitColor="#FFFFFF"
84+
/>
6485
</main>
6586
</template>
6687
<script>
67-
import { VueLive, VueLiveEditor, VueLivePreview } from '../src';
88+
import { VueLive, VueLiveEditor, VueLivePreview } from "../src";
6889
import CustomLayout from "./CustomLayout";
6990
import DatePicker from "vuejs-datepicker";
7091
import codeSfc from "!!raw-loader!./assets/Button.vue";
@@ -77,9 +98,11 @@ import "prismjs/themes/prism-tomorrow.css";
7798
//vue-prism-editor dependency
7899
import "vue-prism-editor/dist/VuePrismEditor.css";
79100
101+
import GithubCorners from "vue-github-corners";
102+
80103
export default {
81104
name: "VueLiveDemo",
82-
components: { VueLive, VueLiveEditor, VueLivePreview },
105+
components: { VueLive, VueLiveEditor, VueLivePreview, GithubCorners },
83106
data() {
84107
return {
85108
registeredComponents: { DatePicker },
@@ -90,18 +113,20 @@ export default {
90113
CustomLayout,
91114
chicagoRequires: { "./chicagoNeighbourhoods": all },
92115
realjsx,
93-
separateCode: codeSfc
116+
separateCode: codeSfc,
94117
};
95118
},
96119
methods: {
97120
updateCode(code) {
98121
this.separateCode = code;
99-
}
100-
}
122+
},
123+
},
101124
};
102125
</script>
103126

104127
<style>
128+
@import url("https://fonts.googleapis.com/css2?family=Nanum+Pen+Script&display=swap");
129+
105130
body {
106131
font-family: "Roboto Mono", monospace;
107132
background-color: #ded;
@@ -124,4 +149,51 @@ body .prism-editor__line-numbers {
124149
text-align: center;
125150
border-radius: 0 10px 10px 0;
126151
}
152+
153+
.description {
154+
max-width: 600px;
155+
margin: 30px auto;
156+
text-align: left;
157+
}
158+
159+
.livebox {
160+
position: relative;
161+
max-width: 950px;
162+
margin: auto;
163+
}
164+
165+
.hint {
166+
position: absolute;
167+
top: 100px;
168+
left: -200px;
169+
font-family: "Nanum Pen Script";
170+
font-size: 2em;
171+
color: red;
172+
transform: rotate(-30deg);
173+
}
174+
175+
@media (max-width: 1400px) {
176+
.hint {
177+
transform: none;
178+
top: -35px;
179+
left: 0;
180+
}
181+
.hint span {
182+
transform: rotate(80deg) translate(10px, 10px);
183+
display: inline-block;
184+
}
185+
}
186+
187+
.button-bar {
188+
height: 70px;
189+
padding: 5px 0;
190+
text-align: left;
191+
}
192+
193+
.button-bar button {
194+
font-size: 1.5em;
195+
padding: 6px;
196+
border-radius: 8px;
197+
width: 200px;
198+
}
127199
</style>

0 commit comments

Comments
 (0)