Skip to content

Commit e34da95

Browse files
committed
feat: add getting started instruction and loading code status
1 parent 777426e commit e34da95

File tree

3 files changed

+93
-16
lines changed

3 files changed

+93
-16
lines changed

src/components/Footer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</footer>
1111
</template>
1212

13-
<style>
13+
<style scoped>
1414
.footer-and-badge {
1515
border-top: 1px solid var(--c-white-dark);
1616
text-align: center;

src/components/Instruction.vue

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<template>
2+
<div class="preview">
3+
<h2>Choose a template on the left to get started.</h2>
4+
<span class="iconify animate-bounce" data-icon="carbon:arrow-left"></span>
5+
</div>
6+
</template>
7+
8+
<style scoped>
9+
.preview {
10+
max-width: 75%;
11+
margin: 25% auto;
12+
text-align: center;
13+
color: #a1a1aa;
14+
}
15+
.iconify {
16+
vertical-align: middle;
17+
width: 10%;
18+
height: 10%;
19+
}
20+
@media (max-width: 768px) {
21+
.iconify {
22+
width: 20%;
23+
height: 20%;
24+
}
25+
}
26+
/* copied from https://windicss.org/utilities/behaviors.html#animation */
27+
/* adjusted with translateX */
28+
@keyframes bounce {
29+
0%,
30+
100% {
31+
-webkit-transform: translateX(0);
32+
transform: translateX(0);
33+
-webkit-animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
34+
animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
35+
}
36+
50% {
37+
-webkit-transform: translateX(-25%);
38+
transform: translateX(-25%);
39+
-webkit-animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
40+
animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
41+
}
42+
}
43+
@-webkit-keyframes bounce {
44+
0%,
45+
100% {
46+
-webkit-transform: translateX(0);
47+
transform: translateX(0);
48+
-webkit-animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
49+
animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
50+
}
51+
50% {
52+
-webkit-transform: translateX(-25%);
53+
transform: translateX(-25%);
54+
-webkit-animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
55+
animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
56+
}
57+
}
58+
.animate-bounce {
59+
-webkit-animation: bounce 1s infinite;
60+
animation: bounce 1s infinite;
61+
}
62+
</style>

src/components/PaneRight.vue

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,41 @@
11
<template>
2-
<div class="right-pane-tabs" v-if="tabs">
3-
<div
4-
v-for="tab in tabs"
5-
:key="tab"
6-
class="right-pane-tab"
7-
:class="{ active: currentTab === tab }"
8-
@click="currentTab = tab"
9-
>
10-
<span class="iconify" :data-icon="getFileType(tab)"></span>
11-
{{ tab }}
2+
<div v-if="tabs">
3+
<div class="right-pane-tabs">
4+
<div
5+
v-for="tab in tabs"
6+
:key="tab"
7+
class="right-pane-tab"
8+
:class="{ active: currentTab === tab }"
9+
@click="currentTab = tab"
10+
>
11+
<span class="iconify" :data-icon="getFileType(tab)"></span>
12+
{{ tab }}
13+
</div>
14+
</div>
15+
<div class="right-pane-contexts" v-if="store.code[currentTab]">
16+
<KeepAlive>
17+
<CodeBlock :lang="getLang" :code="formattedCode()" />
18+
</KeepAlive>
19+
</div>
20+
<div v-else class="loading-code">
21+
<h2>Loading Code...</h2>
1222
</div>
1323
</div>
14-
<div class="right-pane-contexts" v-if="store.code[currentTab]">
15-
<KeepAlive>
16-
<CodeBlock :lang="getLang" :code="formattedCode()" />
17-
</KeepAlive>
24+
<div v-else>
25+
<Instruction />
1826
</div>
1927
</template>
2028

2129
<script>
2230
import CodeBlock from './CodeBlock.vue'
31+
import Instruction from './Instruction.vue'
2332
import { store } from '../store'
2433
import { computed, ref } from 'vue'
2534
import templates from '../templates/templates.json'
2635
import '@iconify/iconify'
2736
2837
export default {
29-
components: { CodeBlock },
38+
components: { CodeBlock, Instruction },
3039
setup() {
3140
const currentTab = ref('README.md')
3241
const tabs = computed(() => {
@@ -94,4 +103,10 @@ export default {
94103
padding: 0;
95104
}
96105
}
106+
.loading-code {
107+
max-width: 75%;
108+
margin: 25% auto;
109+
text-align: center;
110+
color: #a1a1aa;
111+
}
97112
</style>

0 commit comments

Comments
 (0)