functions component wip

master
km0 3 years ago
parent 0950a2f1df
commit 43946fa809

@ -0,0 +1,29 @@
<template>
<div class="arrow">
<transition name="bounce" mode="out-in">
<span :key="animate">🎈</span>
</transition>
</div>
</template>
<script>
export default {
props: {
animate: {
type: Number,
default: 0,
},
},
}
</script>
<style>
.arrow {
align-items: center;
display: flex;
justify-content: center;
font-size: 72px;
}
</style>

@ -0,0 +1,32 @@
<template>
<div class="parameters">
<h2>{{ title }}</h2>
<ul>
<li v-for="param in params" :key="param.id">
<code> {{ param.name }}</code> ({{ param.type.name }})
</li>
</ul>
</div>
</template>
<script>
export default {
props: {
title: {
type: String,
default: '',
},
params: {
type: Array,
default: () => [],
},
},
}
</script>
<style>
.parameters ul {
padding: 0;
list-style: none;
}
</style>

@ -6,48 +6,27 @@
<nuxt-link to="/">back</nuxt-link> <nuxt-link to="/">back</nuxt-link>
</header> </header>
<main> <div class="structure">
<aside> <Parameters title="Input" :params="page.input" />
<h2>Input</h2> <Arrow :animate="animationKey" />
<ul> <Parameters title="Output" :params="page.output" />
<li v-for="input in page.input" :key="input.id"> </div>
<code> {{ input.name }}</code> ({{ input.type.name }})
</li>
</ul>
</aside>
<section class="arrow">
<transition name="bounce" mode="out-in">
<span :key="animationKey">🎈</span>
</transition>
</section>
<aside>
<h2>Output</h2>
<ul>
<li v-for="output in page.output" :key="output.id">
<code>{{ output.name }}</code> ({{ output.type.name }})
</li>
</ul>
</aside>
</main>
<section> <div class="playground">
<h3>Try it:</h3> <h3>Try it:</h3>
<div class="code"> <code>
<code> /functions/{{ page.name }} ?
/functions/{{ page.name }} ? <span v-for="(input, index) in page.input" :key="input.id">
<span v-for="(input, index) in page.input" :key="input.id"> <span v-if="index != 0"> &</span>
<span v-if="index != 0">&</span <input
><input v-model="form[input.name]"
v-model="form[input.name]" type="text"
type="text" :placeholder="input.name"
:placeholder="input.name" />
/> </span>
</span> </code>
</code> <button @click="testApi()">Try</button>
<button @click="testApi()">Try</button>
</div>
<div class="result"> <div class="result">
<h3>Results</h3> <h3>Results</h3>
<div <div
@ -59,9 +38,9 @@
>: {{ results[index] }} >: {{ results[index] }}
</div> </div>
</div> </div>
</section> </div>
<aside> <nav>
<h3>Other functions</h3> <h3>Other functions</h3>
<ul> <ul>
<li v-for="tool in toolkit" :key="tool.id"> <li v-for="tool in toolkit" :key="tool.id">
@ -70,7 +49,7 @@
</nuxt-link> </nuxt-link>
</li> </li>
</ul> </ul>
</aside> </nav>
</div> </div>
</template> </template>
@ -113,7 +92,7 @@ export default {
</script> </script>
<style scoped> <style scoped>
main { .structure {
display: flex; display: flex;
max-width: 1280px; max-width: 1280px;
justify-content: center; justify-content: center;
@ -121,12 +100,13 @@ main {
grid-gap: 24px; grid-gap: 24px;
} }
main > * { .structure > * {
border: 1px solid black;
padding: 24px; padding: 24px;
margin-top: 24px; margin-top: 24px;
flex: 1; flex: 1;
border: 1px solid black;
} }
p { p {
margin-bottom: 16px; margin-bottom: 16px;
} }
@ -138,17 +118,4 @@ h1 {
h2 { h2 {
margin-top: 0; margin-top: 0;
} }
ul {
padding: 0;
list-style: none;
}
.arrow {
align-items: center;
display: flex;
justify-content: center;
font-size: 72px;
}
</style> </style>

@ -1,9 +1,9 @@
<template> <template>
<main> <main>
<section> <section>
<h1>{{ data.title }}</h1> <h1 class="title">{{ data.title }}</h1>
<img :src="'http://localhost:1337' + data.cover.url" alt="" /> <img :src="'http://localhost:1337' + data.cover.url" alt="" />
<div>{{ data.description }}</div> <div class="description">{{ data.description }}</div>
</section> </section>
<aside> <aside>
<h3>Functions</h3> <h3>Functions</h3>
@ -37,7 +37,9 @@ main > * {
padding: 24px; padding: 24px;
} }
section { .description {
margin: 24px 0;
width: 80ch; width: 80ch;
white-space: pre-line;
} }
</style> </style>

Loading…
Cancel
Save