Skip to content

Commit

Permalink
refactor: Improve design of declarative settings
Browse files Browse the repository at this point in the history
* Remove the hint from DOM if empty (otherways they still take some place in layout)
* Individual fields of the same section should not be spaced 60px, 20px (2x 10px) should be enough
* We have the type `multi-checkbox` for real checkboxes where you can select on of multiple, and we have `checkbox` which is only used for enable / disable, so we shall use `switch` type of the checkbox component as we do for all other (non declarative) settings

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Jul 16, 2024
1 parent 465cee2 commit 176f1dd
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
@update:value="onChangeDebounced(formField)"
@submit="updateDeclarativeSettingsValue(formField)" />
</div>
<span class="hint">{{ t(formApp, formField.description) }}</span>
<span v-if="formField.description" class="hint">{{ t(formApp, formField.description) }}</span>
</template>

<template v-if="formField.type === 'select'">
Expand All @@ -41,7 +41,7 @@
:value="formFieldsData[formField.id].value"
@input="(value) => updateFormFieldDataValue(value, formField, true)" />
</div>
<span class="hint">{{ t(formApp, formField.description) }}</span>
<span v-if="formField.description" class="hint">{{ t(formApp, formField.description) }}</span>
</template>

<template v-if="formField.type === 'multi-select'">
Expand All @@ -59,21 +59,22 @@
}
" />
</div>
<span class="hint">{{ t(formApp, formField.description) }}</span>
<span v-if="formField.description" class="hint">{{ t(formApp, formField.description) }}</span>
</template>

<template v-if="formField.type === 'checkbox'">
<label :for="formField.id + '_field'">{{ t(formApp, formField.title) }}</label>
<label v-if="formField.label" :for="formField.id + '_field'">{{ t(formApp, formField.title) }}</label>
<NcCheckboxRadioSwitch :id="formField.id + '_field'"
:checked="Boolean(formFieldsData[formField.id].value)"
type="switch"
@update:checked="(value) => {
formField.value = value
updateFormFieldDataValue(+value, formField, true)
}
">
{{ t(formApp, formField.label) }}
{{ t(formApp, formField.label ?? formField.title) }}
</NcCheckboxRadioSwitch>
<span class="hint">{{ t(formApp, formField.description) }}</span>
<span v-if="formField.description" class="hint">{{ t(formApp, formField.description) }}</span>
</template>

<template v-if="formField.type === 'multi-checkbox'">
Expand All @@ -90,7 +91,7 @@
">
{{ t(formApp, option.name) }}
</NcCheckboxRadioSwitch>
<span class="hint">{{ t(formApp, formField.description) }}</span>
<span v-if="formField.description" class="hint">{{ t(formApp, formField.description) }}</span>
</template>

<template v-if="formField.type === 'radio'">
Expand All @@ -103,7 +104,7 @@
@update:checked="(value) => updateFormFieldDataValue(value, formField, true)">
{{ t(formApp, option.name) }}
</NcCheckboxRadioSwitch>
<span class="hint">{{ t(formApp, formField.description) }}</span>
<span v-if="formField.description" class="hint">{{ t(formApp, formField.description) }}</span>
</template>
</div>
</NcSettingsSection>
Expand Down Expand Up @@ -228,7 +229,6 @@ export default {

<style lang="scss" scoped>
.declarative-form-field {
margin: 20px 0;
padding: 10px 0;

.input-wrapper {
Expand Down

0 comments on commit 176f1dd

Please sign in to comment.