forked from ofs/fensir
feat: layouting form and linting elements
This commit is contained in:
parent
ab17a1c40a
commit
80361ac31f
14 changed files with 109 additions and 35 deletions
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<button class="primary">
|
<button class="primary">
|
||||||
Sign in
|
<slot />
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,11 @@ const formSchema = [{
|
||||||
label: "Server address",
|
label: "Server address",
|
||||||
name: "server-address",
|
name: "server-address",
|
||||||
as: "input",
|
as: "input",
|
||||||
|
}, {
|
||||||
|
label: "Choose a zod schema for data",
|
||||||
|
name: "types",
|
||||||
|
as: "input",
|
||||||
|
asType: "file",
|
||||||
}, {
|
}, {
|
||||||
label: "Price (per request)",
|
label: "Price (per request)",
|
||||||
name: "price",
|
name: "price",
|
||||||
|
@ -61,5 +66,32 @@ const formSchema = [{
|
||||||
form {
|
form {
|
||||||
display: grid;
|
display: grid;
|
||||||
color: var(--primary);
|
color: var(--primary);
|
||||||
|
background: var(--darken);
|
||||||
|
width: 30vw;
|
||||||
|
gap: 20px;
|
||||||
|
padding: 20px 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
form > h3 {
|
||||||
|
font-size: 24px;
|
||||||
|
justify-self: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.form-field {
|
||||||
|
font-size: 16px;
|
||||||
|
display: inline-grid;
|
||||||
|
gap: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.form-field:has(input[type='radio']) {
|
||||||
|
justify-content: start;
|
||||||
|
grid-template-areas: "b a";
|
||||||
|
gap: 10px;
|
||||||
|
& :deep(input) {
|
||||||
|
grid-area: b;
|
||||||
|
}
|
||||||
|
& :deep(label) {
|
||||||
|
grid-area: a;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive } from "vue"
|
import { reactive } from "vue"
|
||||||
import Input from "@/components/Input.vue"
|
import Input from "@/components/Input.vue"
|
||||||
|
import Textarea from "@/components/Textarea.vue"
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
schema: object
|
schema: object
|
||||||
|
@ -10,16 +11,19 @@ const field = reactive(props.schema)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<div class="form-field">
|
||||||
<label v-if="field.label" :for="field.name">{{ field.label }}</label>
|
<label v-if="field.label" :for="field.name">{{ field.label }}</label>
|
||||||
<Input
|
<Input
|
||||||
v-if="field.as === 'input'" :id="field.name"
|
v-if="field.as === 'input'" :id="field.name"
|
||||||
:name="field.name" :type="field.asType || 'text'"
|
:name="field.name" :type="field.asType || 'text'"
|
||||||
:value="field.defaultValue"
|
:value="field.defaultValue"
|
||||||
/>
|
/>
|
||||||
<textarea
|
<Textarea
|
||||||
v-if="field.as === 'textarea'"
|
v-if="field.as === 'textarea'"
|
||||||
|
maxlength="250"
|
||||||
:name="field.name"
|
:name="field.name"
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
const inputModel = defineModel()
|
||||||
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<input class="test" />
|
<input v-model="inputModel">
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
@import url("@/styles/components/inputs.css")
|
||||||
|
</style>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import CarbonArrowRight from '@/icons/CarbonArrowRight.vue'
|
import CarbonArrowRight from "@/icons/CarbonArrowRight.vue"
|
||||||
import CarbonRecentlyView from '@/icons/CarbonRecentlyViewed.vue'
|
import CarbonRecentlyView from "@/icons/CarbonRecentlyViewed.vue"
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
<span class="search__context-title"> context: </span>
|
<span class="search__context-title"> context: </span>
|
||||||
<span class="search__context-item"> global </span>
|
<span class="search__context-item"> global </span>
|
||||||
</div>
|
</div>
|
||||||
<input type="search" />
|
<input type="search">
|
||||||
<div class="search__buttons">
|
<div class="search__buttons">
|
||||||
<CarbonRecentlyView class="icon" />
|
<CarbonRecentlyView class="icon" />
|
||||||
<CarbonArrowRight class="icon" />
|
<CarbonArrowRight class="icon" />
|
||||||
|
|
15
src/components/Textarea.vue
Normal file
15
src/components/Textarea.vue
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
const inputModel = defineModel()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<textarea v-model="inputModel" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
@import url("@/styles/components/inputs.css");
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
resize: none;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -7,3 +7,9 @@ import ContextCreate from "@/components/ContextCreate.vue"
|
||||||
<ContextCreate />
|
<ContextCreate />
|
||||||
</Default>
|
</Default>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
:global(main) {
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
9
src/styles/components/inputs.css
Normal file
9
src/styles/components/inputs.css
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
input, textarea {
|
||||||
|
background: var(--black);
|
||||||
|
outline: 0;
|
||||||
|
border: 1px solid var(--shadow);
|
||||||
|
padding: 0.5rem 0.75rem;
|
||||||
|
&:hover {
|
||||||
|
border: 1px solid var(--accent);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue