mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Add form grid mixin
This commit is contained in:
@@ -188,49 +188,9 @@ body {
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '@/styles/mixins/breakpoint';
|
||||
@import '@/styles/mixins/form-grid';
|
||||
|
||||
.v-form {
|
||||
&.grid {
|
||||
display: grid;
|
||||
grid-template-columns: [start] minmax(0, 1fr) [half] minmax(0, 1fr) [full];
|
||||
gap: var(--v-form-vertical-gap) var(--v-form-horizontal-gap);
|
||||
|
||||
&.with-fill {
|
||||
grid-template-columns:
|
||||
[start] minmax(0, var(--v-form-column-max-width)) [half] minmax(0, var(--v-form-column-max-width))
|
||||
[full] 1fr [fill];
|
||||
}
|
||||
}
|
||||
|
||||
& > .half,
|
||||
& > .half-left,
|
||||
& > .half-space {
|
||||
grid-column: start / fill;
|
||||
|
||||
@include breakpoint(medium) {
|
||||
grid-column: start / half;
|
||||
}
|
||||
}
|
||||
|
||||
& > .half-right {
|
||||
grid-column: start / fill;
|
||||
|
||||
@include breakpoint(medium) {
|
||||
grid-column: half / full;
|
||||
}
|
||||
}
|
||||
|
||||
& > .full {
|
||||
grid-column: start / fill;
|
||||
|
||||
@include breakpoint(medium) {
|
||||
grid-column: start / full;
|
||||
}
|
||||
}
|
||||
|
||||
& > .fill {
|
||||
grid-column: start / fill;
|
||||
}
|
||||
@include form-grid;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,24 +1,22 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="grid">
|
||||
<div class="grid-element full">
|
||||
<p class="type-label">{{ $t('template') }}</p>
|
||||
<v-input class="input" v-model="template" :placeholder="`{{ field }}`" />
|
||||
</div>
|
||||
<div class="grid">
|
||||
<div class="grid-element half">
|
||||
<p class="type-label">{{ $t('template') }}</p>
|
||||
<v-input class="input" v-model="template" :placeholder="`{{ field }}`" />
|
||||
</div>
|
||||
|
||||
<div class="grid-element full">
|
||||
<p class="type-label">{{ $t('interfaces.repeater.edit_fields') }}</p>
|
||||
<repeater
|
||||
v-model="repeaterValue"
|
||||
:template="`{{ field }} — {{ interface }}`"
|
||||
:fields="repeaterFields"
|
||||
/>
|
||||
</div>
|
||||
<div class="grid-element half">
|
||||
<p class="type-label">{{ $t('interfaces.repeater.edit_fields') }}</p>
|
||||
<repeater
|
||||
v-model="repeaterValue"
|
||||
:template="`{{ field }} — {{ interface }}`"
|
||||
:fields="repeaterFields"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="grid-element full">
|
||||
<p class="type-label">{{ $t('interfaces.repeater.add_label') }}</p>
|
||||
<v-input class="input" v-model="addLabel" :placeholder="$t('add_a_new_item')" />
|
||||
</div>
|
||||
<div class="grid-element full">
|
||||
<p class="type-label">{{ $t('interfaces.repeater.add_label') }}</p>
|
||||
<v-input class="input" v-model="addLabel" :placeholder="$t('add_a_new_item')" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -160,10 +158,10 @@ export default defineComponent({
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '@/styles/mixins/form-grid';
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: [start] minmax(0, 1fr) [half] minmax(0, 1fr) [full];
|
||||
gap: var(--form-vertical-gap) var(--form-horizontal-gap);
|
||||
@include form-grid;
|
||||
|
||||
&-element {
|
||||
&.full {
|
||||
@@ -171,8 +169,4 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.type-label {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
</style>
|
||||
|
||||
48
app/src/styles/mixins/form-grid.scss
Normal file
48
app/src/styles/mixins/form-grid.scss
Normal file
@@ -0,0 +1,48 @@
|
||||
@import './breakpoint.scss';
|
||||
|
||||
@mixin form-grid {
|
||||
display: grid;
|
||||
grid-template-columns: [start] minmax(0, 1fr) [half] minmax(0, 1fr) [full];
|
||||
gap: var(--v-form-vertical-gap) var(--v-form-horizontal-gap);
|
||||
|
||||
&.with-fill {
|
||||
grid-template-columns:
|
||||
[start] minmax(0, var(--v-form-column-max-width)) [half] minmax(0, var(--v-form-column-max-width))
|
||||
[full] 1fr [fill];
|
||||
}
|
||||
|
||||
.type-label {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
& > .half,
|
||||
& > .half-left,
|
||||
& > .half-space {
|
||||
grid-column: start / fill;
|
||||
|
||||
@include breakpoint(medium) {
|
||||
grid-column: start / half;
|
||||
}
|
||||
}
|
||||
|
||||
& > .half + .half,
|
||||
& > .half-right {
|
||||
grid-column: start / fill;
|
||||
|
||||
@include breakpoint(medium) {
|
||||
grid-column: half / full;
|
||||
}
|
||||
}
|
||||
|
||||
& > .full {
|
||||
grid-column: start / fill;
|
||||
|
||||
@include breakpoint(medium) {
|
||||
grid-column: start / full;
|
||||
}
|
||||
}
|
||||
|
||||
& > .fill {
|
||||
grid-column: start / fill;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user